X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Rod Pemberton" Newsgroups: comp.os.msdos.djgpp Subject: Re: _CRT0_FLAG_NULLOK Date: Sat, 03 Aug 2013 09:17:38 -0400 Organization: Aioe.org NNTP Server Lines: 51 Message-ID: References: <21e77579-1a40-4442-8111-fc976fba78fc AT googlegroups DOT com> <3df2f50f-9543-47a7-8e40-a9be82ce5018 AT googlegroups DOT com> <87fvuvny2v DOT fsf AT uwakimon DOT sk DOT tsukuba DOT ac DOT jp> <87ehaeonbp DOT fsf AT uwakimon DOT sk DOT tsukuba DOT ac DOT jp> <87zjt1n2v6 DOT fsf AT uwakimon DOT sk DOT tsukuba DOT ac DOT jp> NNTP-Posting-Host: CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Complaints-To: abuse AT aioe DOT org User-Agent: Opera Mail/12.16 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Bytes: 3265 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Thu, 01 Aug 2013 06:04:45 -0400, Stephen J. Turnbull wrote: > Rod Pemberton writes: > > > E.g., [C definition committees] could've specified a NULL pointer > > always points to an emtpy string of just a null character. Such a > > specification is unlikely to break C, since a NULL pointer just > > needs to have a unique address. This would've allowed a NULL > > pointer to safely function as an empty character string too. > > Which is an arbitrary decision, True. But, how is that any different than specifying NULL in the first place? Specifying that NULL exist to detect valid pointers is an arbitrary decision too. This functionality could've been implemented some other way or simply not at all. > [...] because it could be a pointer to an > arbitrary instance of *any* type. If it's been specified by an arbitrary decision, then the pointer points to an arbitrary instance of *one* type out of *many*, yes. No, it wouldn't likely be a pointer to arbitrary instance of some type other than a char. That's the only type that would serve some purpose due to the way strings are implemented in C. Other types don't have this issue. > Of course some of those instances > may be compatible with an empty string, but I don't see how you can > guarantee they *all* will be, on all machines you might want to target > with a C compiler. > [...] So the decision to favor strings is arbitrary. > It would only add additional functionality to NULL for use as char pointers. AISI, additional functionality for other non-char types hasn't demonstrated any theoretical or real world need. Of course, this apparent need only exists because strings in C are implemented as arrays instead a complete type. I.e., they're not "first class citizens". Rod Pemberton -- "... to secure these rights, governments are instituted among men, deriving their just powers from the consent of the governed; that whenever any form of government becomes destructive of these ends, it is the right of the people to alter or abolish it ..." -Thomas Jefferson, Declaration of Independence, 1776