🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd
Article #166

Re: Patch: Sendmail 5.61 core dumps on long lists

#166
From: Andy Linton
Date: Wed, 06 Jun 1990 01:27
37 lines
2223 bytes
In article <60685@lll-winken.LLNL.GOV>, casey@gauss.llnl.gov (Casey
Leedom) writes:
|> 
|>   No, the problem was because the test was:
|> 
|> 	sizeof(foo) - int expression < 0
|> 
|> Sizeof returns unsigned which gives us:
|> 
|> 	unsigned expression - int expression < 0
|> 
|> which type promoting turns into:
|> 
|> 	unsigned expression < 0
|> 
|> which can never be true.  As far as I know ANSI C has not changed anything
|> that would affect this.

'sizeof' used to return an 'int' (see page 126, The C Programming
Language, Kernighan and Ritchie, 1978) and that while Harbison and
Steele (C: A Reference Manual, First Edition, Page 154, 1984)
recommended "that the result of the 'sizeof' operator be either of type
'unsigned int' or of type 'unsigned long'at the discretion of the
implementor" it wasn't standardised at that time.

In Harbison and Steele, C: A Reference Manual, Second Edition, Page 273
they say in referring to Draft Proposed ANSI C that "the result of the
'sizeof' operator may be of type 'unsigned int' or 'unsigned long'. The
type chosen by and implementation is defined as 'size_t' in the standard
header file 'stddef.h'." They also say on Page 299 that the draft
standard requires "the return type of 'strlen' to be 'size_t'". 

The point I was making was that because the type returned by 'sizeof'
and 'strlen' is now 'size_t' which is now *defined* to be 'unsigned int'
or 'unsigned long' the test fails for the reason Casey gives. Previously
the values returned by 'sizeof' and 'strlen' were implementation
dependent and the original test was written in a non-portable manner.
Technical Details
Message-ID: <1990Jun06.012731.18902@comp.vuw.ac.nz>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!comp.vuw.ac.nz!asjl
References: <432@ria.ccs.uwo.ca> <1990May30.221516.6077@comp.vuw.ac.nz> <60685@lll-winken.LLNL.GOV>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!comp.vuw.ac.nz!asjl
From: Andy.Linton@comp.vuw.ac.nz (Andy Linton)
Newsgroups: comp.bugs.4bsd
Subject: Re: Patch: Sendmail 5.61 core dumps on long lists
Message-ID: <1990Jun06.012731.18902@comp.vuw.ac.nz>
Date: 6 Jun 90 01:27:31 GMT
References: <432@ria.ccs.uwo.ca> <1990May30.221516.6077@comp.vuw.ac.nz> <60685@lll-winken.LLNL.GOV>
Sender: news@comp.vuw.ac.nz (News Admin)
Reply-To: Andy.Linton@comp.vuw.ac.nz
Organization: Computer Science Dept, Victoria University, Wellington, NEW ZEALAND
Lines: 37