--------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00063 Date: 04/17/98 From: MATHIEU BOUCHARD Time: 06:11pm \/To: ALEXANDER STASIV (Read 3 times) Subj: 32-bit mode AS>>> I use Borland compiler. Can I compile in 32-bit mode (DOS4GW)? How? AM>> I don't think Borland compilers can make 32-bit DOS apps. Try under AM>> Options|Code Generations (it might be there). AS> There are no 32-bit mode for DOS. :( TC++ 3.0 for DOS requires 32-bit DPMI DLL's. That must be because it had been compiled with a 32-bit compiler, like BC++ 3 for DOS. BorlandC++ once was the "professional edition" of TC++. matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00064 Date: 04/17/98 From: MATHIEU BOUCHARD Time: 06:13pm \/To: DAVID VAN HOOSE (Read 3 times) Subj: reading input from stdin (was: I'm an id18:13:1204/17/98 RA>> char name[40]; RA>> gets(name); DVH> If you do that verbatim, you will have an overflow problem with all DVH> known compilers. This is how that should be: DVH> char name[40]; DVH> gets(name); DVH> name[40]='\n'; DVH> You have to put a NULL on the end or it will have an overflow problem. DVH> I believe you have to do that with 'fgets' as well.. DVH> Just put the null character on the very end of the array. DVH> Hope you like my advice. Peace! That's WORSE. Sorry. '\n' is not null, it's EOL (end of line) name[40] is the first byte AFTER the array. and it doesn't prevent gets from writing like 200 characters, or even 42. fgets has _no_problem_ with that, though -- if you set the maximum number of characters properly. matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00065 Date: 04/26/98 From: MATHIEU BOUCHARD Time: 10:01pm \/To: DARIN MCBRIDE (Read 3 times) Subj: Sorting linked list MB>> Write your quicksort algorithm and i'll see why it can't be applied to MB>> lists... DM> Quicksort, by definition, requires random access. Many methods, such as DM> insertion sort, IIRC, can use bidirectional access (being able to move "by definition" certainly looks good, but it doesn't explain anything. 1. take the 1st element as the pivot. 2. walk through the list, separate the bigs from the smalls by building two lists. looks like a zipper that you unzip. 3. process the two lists separately and recursively. 4. unite them with the pivot. is this a quicksort or not? DM> Quicksort needs to be able to quickly find DM> arbitrary nodes and swap them. This ain't no quicksort, afaik. DM> And I think quicksort has O(log n) timing, unless I'm already forgetting DM> the standard timings. :-) If I'm right, that's a major difference in DM> speed between nlgn and lgn. quicksort, mergesort, heapsort are in n log n time. how do you expect that sorting a collection of n elements takes less than n time? (unless it is pre-ordered to a certain extent, in a known manner) matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00066 Date: 04/26/98 From: MATHIEU BOUCHARD Time: 10:09pm \/To: JONATHAN DE BOYNE POLLARD (Read 3 times) Subj: CALLING DOS COMMANDS MB>> there is a spawn() call in linux/glibc, i think, but that's not POSIX MB>> and that's not a system call either. It might be using vfork or a MB>> similar thing. JdBP> spawn() is not a system call in DOS, Win32, or OS/2 either. Excuse me? Interrupt 21h, a certain function in range 4Ah-4Eh is called "EXEC" and does what spawn() does in MSC 4.00 and TC++3.00 and TC++1.01. i think 4A is a sbrk(), 4C is a _exit() and 4E is a spawn(), in rough manners. matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00067 Date: 04/26/98 From: MATHIEU BOUCHARD Time: 10:23pm \/To: MARK HOOVER (Read 3 times) Subj: compiler MB>> PR> does anyone know of a good c++ compiler? MB>> PR> most of the ones i can get are.... not the best... MH> MB>GNU C++ MH> Do you know if it'll do OS/2 executables on a DOS system? I'm writing a MH> program and Borland 4.52/5.0 don't do OS/2 compilations... well, i don't think so. The DOS version of GNU C++ is a pretty much tweaked thing as far as i remember. But if GNU C++ supports OS/2, well, you could use NetBSD-Amiga to build a GNU C++ compiler that will run on Solaris-SPARC and create executables for OS/2-PC. there's no limit to what you can do (except that the DOS version is independant) you might want to verify yourself, though. matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00068 Date: 04/26/98 From: MATHIEU BOUCHARD Time: 10:32pm \/To: DAVID NOON (Read 3 times) Subj: Sorting Linked List DN> DM>backward one at a time) or even unidirectional access DN> DM>(although usually at the cost of increased stack space). DN> DM>Quicksort needs to be able to quickly find arbitrary nodes DN> DM>and swap them. DN> There is a minor variant of Quicksort, called Mergesort, for sorting DN> linked lists using Hoare's algorithm. sorry, but mergesort has little to do with linked lists, except that it's possible to write one for linked lists, just like for quicksort, independently. mergesort uses an approach that's bottom-up, while quicksort is top-down, and that's the main difference. quicksort splits an array (or a list) at unpredictable points after some sorting; mergesort considers the elements and builds them into small arrays/lists and merge them until they're all merged together. in mergesort the tree of recursivity is pretty much balanced, while in quicksort it's a structure dependent on luck. matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00069 Date: 04/26/98 From: MATHIEU BOUCHARD Time: 10:46pm \/To: DAVID VAN HOOSE (Read 3 times) Subj: convert char to int... DVH>> No. atoi stands for alpha-to-integer. TT>> You're absolutely right. What was I thinking assuming ASCII as the TT>> execution character set :-) DVH> Thanks for not jumping down my throat.. A few people lately have gotten DVH> mad at me for giving them a small correction just out pure kindness so DVH> that they wouldn't sound stupid to someone later, and they have jumped DVH> down my throat.. Is this where our world is going to?? DVH> Later.. ;) No. atoi stands for ALNUM-to-integer. so you like to nitpick in a non-offensive manner? i do too. :-) matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00070 Date: 04/26/98 From: MATHIEU BOUCHARD Time: 10:49pm \/To: PAUL ROBINSON (Read 3 times) Subj: compiler PR> What is the cost of this GNU compiler and where could i get my hands on PR> it? PR> cya The GNU C/C++/ObjectiveC compiler (3-in-1) costs 0.00$ on most legal FTP sites. If you really want to pay for it, you can get it on a CD along with an operating system like Redhat or Slackware, among lots of others. Those CD's should cost you something in the range 10.00$ - 40.00$. (40.00$ is usually for a pack of six) matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00071 Date: 04/24/98 From: TIM HUTZLER Time: 10:24pm \/To: DARRELL HNIZDOR (Read 3 times) Subj: Re: Modem DH>I sent the info via email. DH>If it didn't arrive could be the address. DH>Sure its not chico? instead of hico? It *is* "Chico" trh@ecst.csuchico.edu "ecst" is the computer science department "csu" is for California State University "Chico" is da place, and "edu" is... well, you know the rest. [grin] I poll for mail daily. Look forward in hearing from you. ___ Blue Wave/QWK v2.12 --- Maximus/2 3.01 * Origin: Madman BBS * Chico, California * 530-893-8079 * (1:119/88) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00072 Date: 04/24/98 From: TIM HUTZLER Time: 10:40pm \/To: DARIN MCBRIDE (Read 3 times) Subj: Re: Sort Algorithm TH>Consider the merge or quick sort algorithms: These are examples of TH>O(NlogN) because they belong to the "divide and conqure" genere. TH>You stare with an (supposedly) unsorted list, and you sort it. TH>Heaps are also NlogN, but the sorting is distributed such that the TH>total time is missleading. DM>I think it is quite accurate to call it NlgN since that is the DM>time required to create the heap, irrespective of the DM>creation/loading of the data. If you ignore the *total* time, you DM>become misleading when comparing sorts: lgN looks much faster than DM>quicksort's NlgN, when, in fact, it often isn't any faster in DM>actual practice. Darin, comparing big 'O' *can* in itself be misleading. Sure, appear to be the same, but try using quick sort in a priority queue, or try referencing the 'Nth' element in a heap. Clearly, some algorithems have distinct advantages over others, and it is the programmers judgment to select the one best suited for the job. Heaps are faster because the sort as you go. The min/max value is available in O(lnN). Quick sorts and merge sorts require much longer to sort results, but don't have the front end overhead. DM>We were talking about sorts which imply N elements. When you DM>change the topic to "adding single elements", yes, it becomes DM>O(lgN). Darrin, if you will review my past posts, that *was* the discussion. TH>That don't make sense, Darin. Heaps are generally unsorted as you TH>described. That is, heaps are usually implemented in an array, and TH>viewed in liniar manner appear to be unsorted. But it is orgainzed TH>such that the desired element can be accessed. An unsorted heap is TH>kind of redundant repeats. [grin] DM>Yayayaya... I was confusing binary trees with heaps. My mistake. Don't let it happen again. You have now used up your quota of one mistake per year. [grin] DM>I still get these wrong once in a while, which is why I like to DM>ensure everything is made explicit. :-) Thankfully, C++ (desperate DM>attempt to remind everyone of the topic ) has the standard DM>template library that does all of this for me. Template? Template! TEMPLATE!!!... We don't need no stinkin' Template! [grin] DM>I just need to plug in the right template to my typedef for the DM>performances that I want (fast access? fast sort? fast insert? DM>sorted at all? ...) and away I go. :-) You forgot paper or plastic... [grin] Ah,... I'm gettin crazy, here. ___ Blue Wave/QWK v2.12 --- Maximus/2 3.01 * Origin: Madman BBS * Chico, California * 530-893-8079 * (1:119/88)