TIP: Click on subject to list as thread! ANSI
echo: nthelp
to: Ellen K.
from: Tony Williams
date: 2004-11-22 14:00:14
subject: Re: C++ for beginners?

From: Tony Williams 

Hi Ellen,

That does not sound like fun at all. Still, I've heard it said that
"Premature optimisation is the root of all evil", and if the code
works who's to argue.

I'm surprised that VB6 doesn't have a built-in sort for arrays though.

--
Tony

On 11/21/2004 04:17 PM, Ellen K. wrote:
> True Confessions, or something:   I have a big nasty reporting
> application (nasty because it has to read legacy data in a
"database" of
> DBF files which aren't relational, aren't even 1NF, and can barely
> understand the most simple SQL) and I use a lot of arrays in it,
> especially arrays of user-defined types... and when I have to sort them
> I use a self-written bubble sort.   AFAIK, VB6 does not have a method to
> sort an array.  ADO recordsets have a Sort method, but for most of this
> I don't have recordsets and they wouldn't have worked, or would only
> have made the program even gnarlier.
>
> On Sun, 21 Nov 2004 13:05:49 -0800, Tony Williams 
> wrote in message :
>
>
>>Geo wrote:
>>
>>>"John Beckett"
 wrote in message
>>>news:419f1666.28883121{at}216.144.1.254...
>>>
>>>
>>>
>>>>   // In practice, call the library qsort function.
>>>
>>>
>>>See now this is the part that really ticks me off, we were never shown a
>>>library function called qsort or even a way to find out if one
exists. Seems
>>>to me library functions are one of the most useful features of
C++ compared
>>>to other languages but they have shown us nothing about how to take
>>>advantage of what's available. I can understand not showing us
MFC but they
>>>could have at least allowed us to use functions or classes we find on the
>>>net.
>>
>>Maybe you're ready to take another look at the STL now. The C
"way" is
>>to use library functions, and you're right that there are many of them,
>>but you can't guarantee that they are all available on all platforms
>>unless they're POSIX standard.
>>
>>The C++ "way" is to find a good template library,
subclass your objects
>>and use the methods provided by the library. For example, the STL
>>provides a sort algorithm that's at least as good as qsort and which is
>>just as easy to use.
>>
>>BTW, just so you know where I'm coming from, I prefer to grub around
>>with low level code which hits the hardware directly and, IMO, C with
>>embedded assembler is the only sane way to do this. However, these days
>>I spend most of my time with large higher level programs and that's
>>where C++ really shines. Apart from exceptions, but that's another story.
>>
>>I suppose that using bubble sort is ok if you're being asked to
>>implement a sorting algorithm, but if you're being asked to sort some
>>items then learn how to use existing methods/library functions. It's a
>>valuable lesson because using library functions is much faster/easier
>>and less error-prone than rolling your own. Once that clicks you'll see
>>a whole world of code out there just waiting for you to use it.
>>
>>I know this is an NT group, but I suggest grabbing a Linux distro and
>>reading a few man pages. For this example a quick "apropos
sort" would
>>have pointed you in the right direction.
>>
>>I'm finding it very interesting reading about your progress. Thanks for
>>posting it and I hope you don't mind the back-seat driving.
>
>

--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)
SEEN-BY: 633/267 270 5030/786
@PATH: 379/45 1 396/45 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.