๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5011

It this portable?

#5011
From: Stephen Baynes
Date: Thu, 11 Apr 1996 10:44
26 lines
1476 bytes
In a glossy newsletter from a company (who had better remain nameless) that 
sells tools for testing and validating C code the following bit of code was
given as an example of implementation dependent but portable code across ISO 
C implementations. I know 'portable' is not a term used in the standard, let
us assume it means conforming. Is this program conforming, giving an 
implementation defined result (regardless of the fact the result is probably
not the one intended) or is it going to give undefined behaviour?

 
#include <stdio.h>
#include <limits.h>
int main( void )
{
    printf( "%d", UINT_MAX );
    return 0;
}

My vote is for undefined, but can anyone construct an argument based on
the represention of integers that makes it implmentation defined?

--
Stephen Baynes                              baynes@ukpsshp1.serigate.philips.nl
Philips Semiconductors Ltd
Southampton                                 My views are my own.
United Kingdom
 Are you using ISO8859-1? Do you see ยฉ as copyright, รท as division and ยฝ as 1/2?
Technical Details
Message-ID: <Dpp1tv.4Kq@ukpsshp1.serigate.philips.nl>
Path: arc1-ca.pugleaf.net!phcoms4.seri.philips.nl!panther!baynes

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!phcoms4.seri.philips.nl!panther!baynes
From: baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes)
Subject: It this portable?
Sender: news@ukpsshp1.serigate.philips.nl (account for localnews)
Message-ID: <Dpp1tv.4Kq@ukpsshp1.serigate.philips.nl>
Date: Thu, 11 Apr 1996 10:44:17 GMT
Organization: Philips Semiconductors, Southampton, UK
X-Newsreader: TIN [version 1.2 PL2]