473,385 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Re: Null references.

On 2008-07-15 23:04:29 -0400, "Alf P. Steinbach" <al***@start.nosaid:
>
There are some exceptions to incurring UB for dereferencing a
nullpointer. The most important one is that any given compiler vendor
can decide to give that a well-defined meaning at compile time for that
compiler, and exploit that to implement various macros in the standard
library.
That is not an exception to the meaning of undefined behavior. The
language definition says that certain things result in undefined
behavior, and that means that the language definition doesn't tell you
what those things do. The possiblity that a particular compiler vendor
makes some of those things well defined doesnt change the fact that the
language definition doesn't impose requirements. The behavior is still
undefined.

--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)

Jul 16 '08 #1
1 1055
On 2008-07-16 17:36:59 -0400, "Alf P. Steinbach" <al***@start.nosaid:
* Pete Becker:
>On 2008-07-15 23:04:29 -0400, "Alf P. Steinbach" <al***@start.nosaid:
>>>
There are some exceptions to incurring UB for dereferencing a
nullpointer. The most important one is that any given compiler vendor
can decide to give that a well-defined meaning at compile time for that
compiler, and exploit that to implement various macros in the standard
library.

That is not an exception to the meaning of undefined behavior. The
language definition says that certain things result in undefined
behavior, and that means that the language definition doesn't tell you
what those things do. The possiblity that a particular compiler vendor
makes some of those things well defined doesnt change the fact that the
language definition doesn't impose requirements.

Agreed, up till this point. I was talking about incurring UB and
you're talking about the meaning of UB.
I don't know what "incurring UB" means. The standard simply says that
the behavior of the program is undefined, not that anyting incurs
anything.
>
>The behavior is still undefined.

No, of course it isn't: it's then only undefined with respect to the standard.
It may do what some implementor says it does. That doesn't change the
fact that it's undefined behavior. If you're using the term "undefined
behavior" to mean something other than what the standard says it means,
you need to say so.

--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)

Jul 16 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Bodza Bodza | last post by:
I'm having an argument with an incumbent self-taught programmer that it is OK to use null foreign keys in database design. My take is the whole point of a foreign key is that it's not supposed...
99
by: Mikhail Teterin | last post by:
Hello! Consider the following simple accessor function: typedef struct { int i; char name; } MY_TYPE; const char *
10
by: Jason Collins | last post by:
There are some Requests that occur that have a NULL UserAgent. Some of these are legitimate crawlers (e.g., Overture's crawler), and I'm attempting to adjust my <browserCaps> to correctly classify...
7
by: teddysnips | last post by:
Table DDL below: The tables I have contain Timesheet information. Each row in the tblTSCollected table contains an entry for an employee into the timesheet system, specifically by scanning the...
3
by: Vincent RICHOMME | last post by:
Hi, I would like to know how I can return a NULL reference. usually when I need to return an object and to know if the object is valid I use a pointer (if the object is nto valid I return NULL)...
12
by: Joe | last post by:
I might be overworked so please excuse this stupid question... Say I do the following: DataTable table = new DataTable(); myDataAdaptor.Fill(table); dataGrid1.DataSource = table;
27
by: David W | last post by:
I'm almost tearing my hair out. A colleague claimed that a null reference can exist, like this: void f( int& p ) { printf( "%d\n", p ); } int main (int argc, char *argv) {
11
by: MikeT | last post by:
This may sound very elementary, but can you trap when your object is set to null within the object? I have created a class that registers an event from an object passed in the constructor. When...
76
by: valentin tihomirov | last post by:
As explained in "Using pointers vs. references" http://groups.google.ee/group/borland.public.delphi.objectpascal/browse_thread/thread/683c30f161fc1e9c/ab294c7b02e8faca#ab294c7b02e8faca , the...
8
by: A. Anderson | last post by:
Howdy everyone, I'm experiencing a problem with a program that I'm developing. Take a look at this stack report from GDB - #0 0xb7d782a3 in strlen () from /lib/tls/i686/cmov/libc.so.6 #1 ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.