Wait, GCC doesn't yell at me for using noreturn with -std=c89, even though that doesn't exist in the C89 standard? That's very weird... (Ultimately, it doesn't matter, I'll just need to test on the platforms that actually place the C89 requirement on me instead of testing on a modern x86 Linux, but it's still weird...)

I forgot, is PCC an ANSI C compiler or an K?&R C compiler? Perhaps I could use that for quick testing while I'm away from home and away from my Solaris 7 machine...

Good news: While pcc does not recognise noreturn, if I simply do this (TODO: reasonable way of setting the macro HAVE_NORETURN), it happily compiles my code and doesn't even warn me about the lack of return values in some places...

#ifdef HAVE_NORETURN
#include <stdnoreturn.h>
#define NORETURN noreturn
#else
#define NORETURN
#endif

GCC doesn't complain about my code, either? I don't understand. Shouldn't this cause the compiler to scream at me about the lack of return value?

int hex_digit(char c) {
c = toupper(c);
if (c >= '0' && c <= '9') return c - '0';
else if (c >= 'A' && c <= 'F') return c - 'A' + 10;
else parse_fail(BAD);
}

But neither PCC nor GCC are complaining... I'll have to test with Sun Workshop and MIPSpro at some point, but currently I'm away from all the computers that those compilers are on :/

Follow

@vaporeon_ i’m surpurrised you thought the compilers wouldn’t accept this tbh

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.