delorie.com/archives/browse.cgi | search |
From: | jon_bills AT hotmail DOT com (Jon Bills) |
Newsgroups: | comp.lang.c++,comp.os.msdos.djgpp |
Subject: | Re: Making C++ little easier to beginners... |
Date: | 20 Oct 2001 03:35:10 -0700 |
Organization: | http://groups.google.com/ |
Lines: | 35 |
Message-ID: | <38315c2d.0110200235.2fad7adb@posting.google.com> |
References: | <9qmkrh$581$1 AT tron DOT sci DOT fi> <9qq97t$2df$1 AT tron DOT sci DOT fi> |
NNTP-Posting-Host: | 195.99.244.2 |
X-Trace: | posting.google.com 1003574110 327 127.0.0.1 (20 Oct 2001 10:35:10 GMT) |
X-Complaints-To: | groups-abuse AT google DOT com |
NNTP-Posting-Date: | 20 Oct 2001 10:35:10 GMT |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
"Traveler" <traveler AT netti DOT fi> wrote in message news:<9qq97t$2df$1 AT tron DOT sci DOT fi>... > Let me make few things clear: [snip] > 5) Dietmar Kuehl wrote: > >> Nope, you cannot: >> >> if (ptr == 0 || ptr->something()) >> ; >> >> will work correctly when being passed a corresponding null pointer while >> >> if (ptr == 0 | ptr->something()) >> ; >> >> will not: It will "crash" (ie. invoke "undefined behavior") when applying the >> '->' operator. > > Strange...it did not crash in my maschine.... Unfortunately, Dietmar used the word "crash" in his post. However, you should understand he was pointing out that the result is *undefined behaviour*, one possibility of which is the machine crashing; another possibility is apparently correct behaviour. If you are not familiar with the definition of undefined behaviour, then I suggest you get your hands on a copy of the C++ Standard. The lesson is to not rely on your compiler as defining the correct behaviour of C++. [snip] Jon.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |