Subject: Type coersion long->int ?
To: None <current-users@netbsd.org>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: current-users
Date: 02/02/2000 18:22:06
On i386, I reliably get a segmentation fault with the following program:

#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
  int c;
  srandom(42);
  c=(int)random(); /* random returns long */
  if(isalpha(c))   /* isalpha takes int   */
    printf("%c",c);

  return 0;
} 

The fault happens at if(isalpha(c)). Am I actually doing something illegal,
or is there a problem here?

Cheers,

Patrick