From: Paul AT chocolat DOT foobar DOT co DOT uk (Paul Shirley) Subject: Re: strlen on a NULL 15 May 1998 09:57:57 -0700 Message-ID: References: <199805130145 DOT LAA18828 AT mali DOT comdyn DOT com DOT au> Mime-Version: 1.0 Cc: gnu-win32 AT cygnus DOT com In message <199805130145 DOT LAA18828 AT mali DOT comdyn DOT com DOT au>, raf writes >nonsense. if strlen() doesn't crash when given a null pointer, the only >reason is that the implementation must contain a test for the null pointer. Or memory is mapped and unprotected at 0, and theres a terminating zero somewhere before unmapped/protected memory. >this is atypical. strlen(NULL) normally crashes on unix. unix core files >may start at address zero, but zero is an illegal address. this is deliberate. >using null pointers is so common an error in c programming, that the null >address was deemed to always be invalid. remember that c and unix were >invented together. Using NULL in most libc functions has *undefined* behaviour. Accessing at :NULL is not illegal in C, just a very bad idea. On my Atari ST :0 is protected, on my Playstation its not. I get an exception on the ST and trap the code that caused it, my Playstation crashes sometime later that day for no obvious reason ;) You just got lucky with Win32 trapping NULL access, be grateful. -- Paul Shirley - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".