Minor issue

From: David C Black <dcblack@mac.com>
Date: Wed Jul 28 2010 - 12:08:27 PDT

First, I promise to jump in and comment anytime we disagree or think we might have an improvement over the discussion. If I am silent, you may assume either (1) we completely agree, or (2) we don't think it's a critical issue. Anytime you ask for folks to "vote yea/neigh", I will respond with our position.

Second, reviewing the spec, I found a minor issue:

Section 3.3.3.2 Functions that return char*
Certain functions have the return type char*, that is, they return a pointer to a null-terminated character
string. Such strings shall remain valid until the end of the program with the exception of member function
sc_process_handle::name and member functions of class sc_report, where the implementation is only
required to keep the string valid while the process handle or report object itself is valid.

See section 5.6.5 page 60 const char* name() const;
What does it mean to keep the string valid in the last sentence?
char *str1 = ""; //nullstr
char *str2 = 0; // nullptr
char *str3 = new char[6]; strncpy(str3,"hello",6);
char* func(void) { char going_away[6] = "awful"; return going_away; }
char *str4 = func(); // uninitialized and potentially points randomly
str1, str2 and str3 are valid in the sense that all three are knowable
if (str == 0) cout << "is null pointer\n";
else if *str != '\0' << "is empty\n";
else cout << "might be decent content \"" << str << "\"\n";
str4 is definitely invalid technically
Just want to be clear
Perhaps should add a definition of what a valid string is earlier in the document?

David C Black
Your innovative system design professional
http://www.Xtreme-EDA.com (formerly ESLX.com)
Voice: 512.850.4322 Skype:dcblack FAX: 888.467.4609

Unix is a user-friendly operating system. It just picks its friends more carefully than others.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Jul 28 12:09:13 2010

This archive was generated by hypermail 2.1.8 : Wed Jul 28 2010 - 12:09:16 PDT