ripcobalt / terminal-ide

Automatically exported from code.google.com/p/terminal-ide
0 stars 0 forks source link

isspace etc. crash with NDEBUG #81

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Compile and run this program, it will crash:
#define NDEBUG
#include <ctype.h>
int main(void)
{
  return isspace(0x3b);
}

The problem is that these optimized is* functions use a _ctype_ pointer to look 
the variables up, however that pointer is 0.
Not even calling setlocale fixes this. A quick hack might be to ensure this 
variable is initialized to some default table for ASCII.

As a side note, I have philosophical objections against the variable name, only 
variables starting with two underscores or underscore and uppercase are 
reserved for the system in POSIX, so this naming is probably not conformant. 
However that is rather an issue with OpenBSD/NetBSD than this project.

Original issue reported on code.google.com by reimar.d...@gmail.com on 3 Mar 2013 at 9:15