| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: This always drives me cr |
Hello William! Aug 02 01:43 03, William McBrine wrote to Bo Simonsen: WM>> for (int x = 0; x < 100; x++) BS>> That's not ANSI C/C++, it should be: BS>> int x; BS>> for(x=0; x < 100; x++) WM> It's not ANSI C, but it _is_ standard C++. Since this is the C++ WM> echo, I thought that would be OK. :-) Admittedly, the rest of the message WM> would apply just as well to C as to C++, if one replaced "new" with WM> malloc(). I almost referred Neil to the K & R book, which devotes a WM> chapter to pointers and arrays. Yes it's standard C++ :-) But the Kerninghan and Richie book is only about ANSI C ;-) WM> You're probably thinking of the change in scope specified in ANSI WM> C++, where the variable now goes out of scope at the end of the loop. But WM> it's still valid _within_ the loop, as I used it. I guess 'i' would be aviable after the loop? BS>> I know borland c++ compile it, but gcc/g++ doesn't. WM> Yes, it does. (More precisely: g++ does; gcc doesn't. That is to say, WM> it works in C++ mode, and not in C mode.) Okey.. :-) Regards, Bo --- Msged/LNX 6.1.2* Origin: The Night Express, Roennede Dk (2:236/100) SEEN-BY: 633/267 270 @PATH: 236/100 237/9 20/11 106/1 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™.