| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | For loops in C... |
Hi Bob
BL> I got all excited writing macros, but unless you use it lots, you
BL> may as well just write it longhand a few times.
Complex macros in C are frowned on, they can almost always be
written in conventional code in the same space. Also, some
compilers can give confusing error messages if the error is inside
a macro. Macros make good band-aids, they're great for changing
basic definitions for different compilers, or for doing conditional
compiling for debugging. They're less great for code shorthand.
BL> And what's the logic behind your syntax? For instance, you put:
PE> if (i == end)
PE> {
PE> i = 0;
PE> }
PE> if (i == mid)
PE> {
PE> finished = 1;
PE> }
BL> but I would have gone:
BL> if(i == end) i = 0;
BL> if(i == mid) finished = 1;
BL> To me, this shows the flow of logic better, and reveals that you
BL> are testing for i unnecessarily in most cases.
The "syntax" is identical. The "indenting" is
different. Indenting
to C people is like religion to Northern Irish people.
Cheers
--- PPoint 1.88
* Origin: Silicon Heaven (3:711/934.16)SEEN-BY: 711/808 934 712/610 @PATH: 711/934 |
|
| 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™.