[SystemSafety] Fwd: Re: Correcting the SECOND screw-up (grovelling apologies)

Derek M Jones derek at knosof.co.uk
Tue Jul 14 17:59:14 CEST 2020


Olwen,

> But, as I once found in a system that suffered from what might be called "chaotic configuration management", it is quite 
> easy for a C compiler to include an incorrect <limits.h> file. I'm thinking of a case at a Telco where a workstation 

Yes, these things happen.

Actually any small negative value will do (I happened to be thinking
of the contents of limits.h when I saw this post).

#include <stdio.h>

int main(void)
{
char ch=-1;

if (ch < 0)
    printf("char is signed\n");
else
    printf("char is unsigned\n");

}

-- 
Derek M. Jones           Evidence-based software engineering
tel: +44 (0)1252 520667  blog:shape-of-code.coding-guidelines.com


More information about the systemsafety mailing list