c90

What are the major differences between ANSI C and K&R C?

The Wikipedia article on ANSI C says: One of the aims of the ANSI C standardization process was to produce a superset of K&R C (the first published standard), incorporating many of the unofficial features subsequently introduced. However, the standards committee also included several new features, such as function prototypes (borrowe...

Are prototypes required for all functions in C89, C90 or C99?

To be truly standards-compliant, must all functions in C (except for main) have a prototype, even if they are only used after their definition in the same translation unit? ...

Type to use to represent a byte in ANSI (C89/90) C?

Is there a standards-complaint method to represent a byte in ANSI (C89/90) C? I know that, most often, a char happens to be a byte, but my understanding is that this is not guaranteed to be the case. Also, there is stdint.h in the C99 standard, but what was used before C99? I'm curious about both 8 bits specifically, and a "byte" (size...

The bounds on void-pointers in ANSI C89/ISO C90

Is there a way to portably determine the upper and lower bound on void-pointer values in ANSI C89/ISO C90? (I currently do not have a copy of the standard with me (I have one at home). Of course if void-pointer values are guaranteed to be unsigned this task is trivial (via sizeof(void *)); however, I cannot recall if this is guaranteed ...

Is "The C Programming Language" (book) current?

Is the version of C taught by this rather old, but frequently mentioned, book the same as that which is being used in the real world today? If not, could anyone list or point to a list of the differences? ...

ANSI C (ISO C90): Can scanf read/accept an unsigned char?

Simple question: Can scanf read/accept a "small integer" into an unsigned char in ANSI C? example code un_char.c: #include <stdio.h> #include <stdlib.h> int main(void) { unsigned char character; scanf("%hhu", &character); return EXIT_SUCCESS; } Compiled as: $ gcc -Wall -ansi -pedantic -o un_char un_char.c un_char.c:...

Can't get ride of "this decimal constant is unsigned only in ISO C90" warning

Hi, I'm using the FNV hash as a hashing algorithm on my Hash Table implementation but I'm getting the warning in the question title on this line: unsigned hash = 2166136261; I don't understand why this is happening because when I do this: printf("%u\n", UINT_MAX); printf("2166136261\n"); I get this: 4294967295 2166136261 Which ...

Recommended Clang command line options

The Manual for Clang seems to be work in progress, so could you help me formulate the definitive command line options for compiling ANSI-C (AKA C89, C90) with maximum strictness and relevant/helpful warnings? Clang is a compiler front end for the C, C++, and Objective-C programming languages. It uses the Low Level Virtual Machi...

Compile for freestanding environment with GCC

The code I'm working on is supposed to be possible to build for both hosted and freestanding environments, providing private implementations for some stdlib functions for the latter case. Can I reliably test this with just GCC on a normal workstation/build server? The "-ffreestanding" option looked promising, but it seems that it "on...

mixed declarations and codes

When I compile function with "gcc -o dene -Wall -ansi -pedantic-errors dene.c" ,gcc emits no error.(can you look a line which starts with char ....,in if loop,) static void remove_negation(char *s,char *s1) { char **cmainp=malloc(sizeof(char*)*1); int len=0;int d=0; int i=0; ...

How to use make and compile as C99?

I'm trying to compile a linux kernel module using a Makefile: obj-m += main.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean Which gives me: main.c:54: warning: ISO C90 forbids mixed declarations and code I need to switch to C99. After...

C90 - C99: register struct

Hello is "register struct" legal? In terms of standards and (separated from standards) in Gcc? ...