| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Pointers |
G'day Roger,
Sun 2003-09-07 22:36, Roger Scudder (2:292/516.666) wrote to All:
>>> KK> By default, 0 is equal to untrue. If you test a value, such
RS> as
>>> KK> a pointer, the conditional will be true for any nonzero value.
>>> Okay.
>>> KK> if(myPointer) free(myPointer);
>>> The same as if(myPointer != NULL) i bet?
RS> Yes, but it is so unintuitive that just about anyone who has ever
RS> learned C has initially found it confusing.
I've seen written C++ for some years.. And now i'm writing C, just for that
reason I think C programs works better on Linux, and there is no reason for
writing C++ then I'm not using Classes and so on.
RS> If you look at the code in snippets you won't see "if(pointer)".
RS> What you will see is "if (NULL != pointer)". Unless your goal is
RS> to purposely exploit certain loosely defined aspects of the
RS> language, doing so is, IMHO, just bad style.
Okay.
RS> Obviously not everyone here agrees with me, and that is fine. It is
RS> up to the individual to decide which path to take.
I didn't saw that :)
RS> -Roger
RS> Pennsylvania, USA
RS> p.s. I remember Auke once said that we should all put our
RS> geographical locations below our sigs. I always thought that was a
RS> really nice idea.
Regards,
Bo Simonsen
Roennede, Denmark, Europe.
--- timEd/Linux 1.11.b1
* 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™.