--------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBG00006 Date: 07/11/97 From: BOB STOUT Time: 01:58pm \/To: CAMERON CLARK (Read 3 times) Subj: Re: Signs of numbers On , Cameron Clark (1:3811/350@fidonet) wrote: > The first bit of a number signifies the sign of a number so > char c = (some number); > negative = (c & 0x80); > zero = (c & (-1)); > positive = !negative; Cameron... Quite correct, the MS bit of any two's complement integral type represents the sign on a two's-complement machine. Your code, however suffers from several fatal flaws: 1. It only works on two's-complement machines. The C and C++ language standards have been written to allow implementation on machines using other numeric representations. 2. Your code only works on char's. Any other integral type (short, int, ong) will break it. 3. Your code is guaranteed not to work on floats or doubles. 4. Even if you restrict your functionality *only* integral type and add support for short's, int's, and long's, it will fail on unsigned types. 5. Depending on your machine's architecture, it may fail on multibyte integral types depending on the "endianness" of your hardware. What I posted previously may be longer than yours, but it will work correctly on machines using any sort of numeric representation, on *any* built-in type, and with either C++ (with or without templates) or C. --- QM v1.00 * Origin: MicroFirm : Down to the C in chips (1:106/2000.6) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBG00007 Date: 07/10/97 From: BALOG PAL Time: 07:24am \/To: RAFA VELILLA (Read 3 times) Subj: Reset Hi, Rafa Velilla! On 07 Jul 97 05:21:00 you wrote to Juhan-A Nakkalajarvi JN> asm jmp 0FFFFh RV> I have used INT 19h (I think it jumps to that direction so it has RV> the same behaviour). int 19h is a big No-No to reboot the computer. It doesn't do all the work, and as most important, it doesn't restore the interrupt vector table. If you installed any tsr's you probably end up in a lockup or even worse things could happen. To reboot one must jump to ffff:0 as a plenty of people wrote before (and handle the warm-boot flag too) or to make a physical reset, you out value 0xfe to port 0x64. Both cases may cause data loss due to not flushed cache or similar. Paul PSTM: sorry for the off-topic, but the above info is just too dangerous to leave unanswered. ... Damn, another mutation! --- OS/2 Warp * Origin: The FlintStones' Cave in BedRock (2:371/20) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBG00008 Date: 07/11/97 From: KEN WAUGH Time: 01:35pm \/To: DARIN MCBRIDE (Read 3 times) Subj: Re: fork for watcom DM> The only platform that I know that has fork() in the above list is OS/2 DM> via EMX. I don't know if DJGPP supports it. Now you know of another OS that supports fork(). It's a standard with the Amiga.. ALL amiga OS' from the 1st to current OS 3.1.. Gotta luv this multitasking..... * AmyBW v2.14 * --- GEcho 1.00 * Origin: Static Line C= Support 407-633-6855 (1:374/128) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBG00009 Date: 07/12/97 From: JERRY COFFIN Time: 01:00am \/To: NEIL HELLER (Read 3 times) Subj: Modeless dialog boxes On (10 Jul 97) Neil Heller wrote to Jerry Coffin... NH> I have run into a real stone wall in trying to construct a modeless NH> dialog box in MSVC + MFC. First I constructed a class derived from NH> CDialog called Modeless. In that class I have a member pointer: NH> CDialog * m_pModelessDialog; Your dialog class is derived from CDialog - there's no need for it to contain a pointer to a CDialog because it IS a CDialog. NH> Then in the source file: NH> Modeless abc; NH> abc.m_pModelessDialog = new Modeless; NH> if (!abc.m_pModelessDialog->Create(IDD_DIALOG1) { NH> AfxMessageBox("Dialog creation failed",MB_OK); NH> exit(1); NH> } I _seriously_ doubt that you want a modeless dialog to be an automatic variable - the dialog is going to be destroyed on command, not when you leave whatever scope this code happens to be in. I did a quick AppWizard app and added a menu entry to create a dialog, linked to code to create a modeless dialog like this: void CStuffView::OnDialog() { modeless *dlg = new modeless; if ( !dlg->Create(MODELESS)) { AfxMessageBox("Unable to create dialog.", MB_OK); PostQuitMessage(1); } } Destroying the dialog was handled like this: void modeless::OnButton1() { DestroyWindow(); } Obviously I also had to create a dialog template named MODELESS, with a button to tell when its job was done. This compiled and ran just fine. However, none of this should have actually stopped your code from compiling - it almost sounds like your MFC header might have somehow gotten the prototype for one version of CDialog::Create deleted from the file so the compiler no longer sees it. However, it's hard to believe that a header could be munged and only affect one prototype unless this happened by operator error. Later, Jerry. ... The Universe is a figment of its own imagination. --- PPoint 1.90 * Origin: Point Pointedly Pointless (1:128/166.5) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBG00010 Date: 07/11/97 From: JERRY COFFIN Time: 11:49pm \/To: MIKE PATTEN (Read 3 times) Subj: Sunir ventures into c++ On (11 Jul 97) Mike Patten wrote to Erik Warmelink... MP> I normally just type g++ file.cpp -o file. I guess I should start MP> using -Wall to really check for portability. I'll check to see how MP> it's done with Borland C++, too. You might also want to use -O2 for normal compilation. Though this appears to merely add optimization, in fact the optimizer does quite a bit of flow analysis. The flow analysis allows the compiler to do a better job of detecting when you might use a variable without initializing it first. Later, Jerry. ... The Universe is a figment of its own imagination. --- PPoint 1.90 * Origin: Point Pointedly Pointless (1:128/166.5) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBH00000 Date: 07/11/97 From: CHRISTOPHER BUTLER Time: 04:02pm \/To: GABOR MANIC (Read 3 times) Subj: Help me! Hi Gabor! When Gabor Manic wrote to Christopher Butler on Sunday July 06 1997, Gabor was talking about Help me!. CB>> char i; CB>> if (inp(0x64) & 1) // same as kbhit() GM> ^^^^^^^^^^^^^^^ GM> The problem is here No it isn't, the & won't change the variable... if (inp(0x64) && 1) means "If inp(0x64) is true, and 1 is true, then go" The problem is with getch()... it hangs the computer (in pure DOS), or crashes the Win95 DOS box... Chris --- FMail/Win32 1.22 * Origin: Death Butler BBS, +44-1582-620141, 24 Hours (2:257/135) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBH00001 Date: 07/10/97 From: NEIL BURROWS Time: 08:42pm \/To: DALE RODDA (Read 3 times) Subj: vc++ 5 book Hi, 06-Jul-97 12:28:32, Dale Rodda wrote to all Subject: vc++ 5 book DR> I have done a fair amount of c and c++ programming using the borland DR> compilers. However, I need to learn the microsoft vc version 5. Any good DR> book that you would recommend. Try Beginning Visual C++ 5 published by Wrox Press Ltd. I've not personally seen this book, however I had the one for Version4, and found it really good. The price here is 36.99ukp. The v4 one was really thick, but the first part of the book was more on learning c++. It took you through everything (well, all the basics, and then some) and I found it was set out very nicely, and it is still usefull for reference! :) I've also read the Wrox books for 'C' and Visual Basic 4 and found them all very good indeed. See ya, Neil Burrows Internet: neil@remo.demon.co.uk * Web : ttp://www.remo.demon.co.uk/ : nburrows@cs.strath.ac.uk * FidoNet : 2:258/1.19 --- Terminate 4.00/Pro * Origin: Flight of Fantasy BBS. Glasgow, Scotland, UK. (2:258/1.19) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBH00002 Date: 07/08/97 From: ALEX TELISCHAK Time: 06:29pm \/To: BOB STOUT (Read 3 times) Subj: Donating to SNIPPETS hi. i was wondering ( i haven't seen the SNIPPETS faq recently ) how one goes about donating code for inclusion in the next SNIPPETS release. do i simply post it in the c++ programming or c programming echo(s)? or, do i send it email|netmail|whatever to you directly? thanks for the reply. later.. alex telischak (eponymous@juno.com / www.geocities.com/SiliconValley/Park/2058/) SLMR 2.1a Unable to locate Coffee -- Operator Halted! --- Alexi/Mail 2.02b (#10000) * Origin: BrickYard BBS Gonic, NH 603 332-0419 (1:132/243) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBH00003 Date: 06/24/97 From: DAVID TORREZ Time: 05:12am \/To: JERRY JANKURA (Read 3 times) Subj: C++ builder ide -> Does anyone who uses the Borland C++ Builder system know if there are -> any additional keys for the registry to allow one to specify a -> default location, height, and width of the code window? I know that -> there used to be strings in the INI file from Borland Delphi-1 that -> allowed one to specify these items; Since BCBuilder is kind of -> derived from Delphi, I just wondered if its IDE acted similarly. It is pretty much the same IDE, and while we are at it, the same Framework (VCL). Dave - zanti@pacbell.net --- QScan/PCB v1.19b / 01-0218 * Origin: The Target Range II 310/634-8993 (1:102/420) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: EBH00004 Date: 07/12/97 From: ERIK WARMELINK Time: 02:07am \/To: MIKE PATTEN (Read 3 times) Subj: Sunir ventures into c++ Mike, you wrote to Erik Warmelink : MP> I normally just type g++ file.cpp -o file. I guess I should MP> start using -Wall to really check for portability. I'll MP> check to see how it's done with Borland C++, too. I _have_ to use -Wall, because my code is very sloppy. I prefer a warning by the compiler to a debugging session, I have enough of those even when I do. ;-) If you want to check on portability the -ansi switch also helps a lot. But even using that the compiler doesn't know that other compiler have short ints as their default ints etc.. Bye, Erik --- * Origin: WarmelinkE@vertis.nl (2:282/1.60)