[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: c99 support
From: |
Chris Vine |
Subject: |
Re: c99 support |
Date: |
Sun, 24 Jun 2018 01:00:43 +0100 |
On Sat, 23 Jun 2018 22:12:39 +0200
Andy Wingo <address@hidden> wrote:
> Hi,
>
> Is there anyone who compiles Guile with a compiler that does not support
> C99? If so, please give platform and compiler.
>
> I think my questions are limited to, in decreasing order of importance:
>
> * Is there any system that we target that doesn't have C99 stdint.h
> and stddef.h ?
>
> * Is there any system that we target that doesn't support C99 inline
> functions?
>
> * C99 mixed decls and statements?
>
> * C99 one-line comments (// foo) ?
>
> * C99 compound literals? ((struct x) { 1, 2 }) ?
>
> * stdbool.h
>
> I would like to use C99 inside Guile, and I want to eventually replace
> scm_t_uint8 with uint8_t.
I include guile headers in C++11 code. These C99 features seem to
be in current C++ (uint8_t is definitely supported if available on
the platform), except that my earlier assumption that compound literals
were in C++11 was wrong. They do work, but that's because they are a
supported gcc, clang and MSVC extension in C++. That's decent coverage
though.
Although stdbool.h exists in C++11, its contents are signficantly
reduced in scope because bool is separately supported in C++. The
definitions of bool are different in C99 and C++ - it is an integer type
plus macro in C99 - which might cause problems if the sizes of bool in
C++ and C99 are different. It would be a very poor implementation which
does this, but stdbool.h may be best avoided in a guile header file.
This is not relevant if you are only including C99 features in
implementation (*.c) files. That will always work OK.
Chris