Skills list is in an array already. Or at least, it is in stock ROM. I don't know what all Ivan's OLC 2 does.
----- Original Message ----- From: "Valnir" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Wednesday, January 28, 2004 7:12 PM Subject: Re: Qsort > Ok.. I just wanted an explanation / clarification... I will consider > changing my code.. but why is it when I posted my findings for my skill list > last week, no one spoke up?? > > -V > > ----- Original Message ----- > From: "Chad Simmons" <[EMAIL PROTECTED]> > To: "Valnir" <[EMAIL PROTECTED]> > Cc: <[email protected]> > Sent: Wednesday, January 28, 2004 7:15 PM > Subject: Re: Qsort > > > > > > --- Valnir <[EMAIL PROTECTED]> wrote: > > > Well, since I don't have 100% C/C++ programming knowledge, I am not > going to > > > argue with either of you two (Mike/Kender)... all I know is that my > Skills > > > list sorts and his Helps sort ok by using the "Linked List" that you > both > > > are saying won't work... > > > > > > Here is my question: > > > > > > Once you read the file contents into memory, doesn't it technically > become > > > an array??? If it DOES, then you can sort it directly. > > > > No, it does not. The reason that it _seems_ to be working in both cases is > due > > to the fact that you are probably allocating the memory sequentially, and > not > > adding or removing elements from the list before you try and sort it. Let > me > > assure you that calling qsort on a linked list is undefined behavior. Yes > it > > may work for you now, but next week it may not.. You can't tell because > it's > > not defined behavior. Using an array (either directly, or through a > wrapper > > function) does have a defined behavior and will work every time (assuming > there > > are no hardware problems, etc) regardless of the phases of the moon, or > > anything else. > > > > So if you like random crashing, data munging, and other fun debugging > > headaches, feel free to continue as is. If you want consistancy, and error > free > > code, use an array when calling qsort. > > > > ~Kender > > > > ===== > > -----BEGIN GEEK CODE BLOCK----- > > Version 3.1 > > GCS/L/C/O d-(+) s++: a-- C+++$>++++ UBLS++++$ > > P+++(--)$ L+++>++++ E--- W+>++$ N !o K? w(--) !O > > M- !V PS+ PE(++) Y+ PGP->+ t+ 5 X+() R(+) tv+@ > > b++(+++) !DI+++ D G(-) e>+++$ h---() r+++ y+++ > > ------END GEEK CODE BLOCK------ > > > > __________________________________ > > Do you Yahoo!? > > Yahoo! SiteBuilder - Free web site building tool. Try it! > > http://webhosting.yahoo.com/ps/sb/ > > > > > -- > ROM mailing list > [email protected] > http://www.rom.org/cgi-bin/mailman/listinfo/rom

