* c99 support
@ 2018-06-23 20:12 Andy Wingo
2018-06-24 0:00 ` Chris Vine
2018-06-29 7:39 ` Andy Wingo
0 siblings, 2 replies; 5+ messages in thread
From: Andy Wingo @ 2018-06-23 20:12 UTC (permalink / raw)
To: guile-user
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.
Thanks,
Andy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: c99 support
2018-06-23 20:12 c99 support Andy Wingo
@ 2018-06-24 0:00 ` Chris Vine
2018-06-24 9:13 ` Arne Babenhauserheide
2018-06-29 7:39 ` Andy Wingo
1 sibling, 1 reply; 5+ messages in thread
From: Chris Vine @ 2018-06-24 0:00 UTC (permalink / raw)
To: guile-user
On Sat, 23 Jun 2018 22:12:39 +0200
Andy Wingo <wingo@pobox.com> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: c99 support
[not found] ` <874lht4683.fsf@pobox.com>
@ 2018-06-24 2:37 ` Eli Zaretskii
0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2018-06-24 2:37 UTC (permalink / raw)
To: Andy Wingo; +Cc: guile-user, guile-devel
> From: Andy Wingo <wingo@pobox.com>
> Cc: guile-users@gnu.org, guile-devel@gnu.org
> Date: Sat, 23 Jun 2018 22:07:24 +0200
>
> > MS-Windows (MinGW) doesn't have a C99 compliant C library, although
> > quite a few of what's needed is present.
>
> Hard to say :) 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
All of the above is available with reasonably recent versions of MinGW.
> I assume MinGW uses GCC. What version? I see that the version 6 series
> is available on mingw.org.
Current versions are 6 and 7, I have 5.3 installed on one of my
machines. All of them support what you mentioned.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: c99 support
2018-06-24 0:00 ` Chris Vine
@ 2018-06-24 9:13 ` Arne Babenhauserheide
0 siblings, 0 replies; 5+ messages in thread
From: Arne Babenhauserheide @ 2018-06-24 9:13 UTC (permalink / raw)
To: Chris Vine; +Cc: guile-user
[-- Attachment #1: Type: text/plain, Size: 1670 bytes --]
Chris Vine <vine35792468@gmail.com> writes:
> On Sat, 23 Jun 2018 22:12:39 +0200
> Andy Wingo <wingo@pobox.com> 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.
OpenIndiana requires GCC 4.4.4 to build, so if Guile should be usable
for Solaris/Illumos development, compatibility to that would be
important. 4.4.4 seems to already support major parts of C99, but I’m not
sure whether something is missing: https://gcc.gnu.org/c99status.html
https://wiki.illumos.org/display/illumos/How+To+Build+illumos#HowToBuildillumos-GCC
Best wishes,
Arne
--
Unpolitisch sein
heißt politisch sein
ohne es zu merken
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1076 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: c99 support
2018-06-23 20:12 c99 support Andy Wingo
2018-06-24 0:00 ` Chris Vine
@ 2018-06-29 7:39 ` Andy Wingo
1 sibling, 0 replies; 5+ messages in thread
From: Andy Wingo @ 2018-06-29 7:39 UTC (permalink / raw)
To: guile-user; +Cc: guile-devel
On Sat 23 Jun 2018 22:12, Andy Wingo <wingo@pobox.com> writes:
> 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.
Thanks all for the responses. It would seem that the first four
features of C99 are OK for all platforms that we target, with the
following caveats:
* We should avoid using C++ keywords (e.g. throw) in Guile API files.
* We might want to avoid mixed decls and statements in inline functions
in Guile API files.
We should probably avoid stdbool.h and compound literals, for C++
reasons.
In Guile 3.0 (master branch), the types "scm_t_uint8" and so on are now
deprecated. My recommendation is that all users switch to use
e.g. "uint8_t", "ptrdiff_t", etc from <stdint.h> instead of the
scm_t_uint8, etc definitions that they are now using. The definitions
are compatible on all systems, AFAIU, and on GNU, scm_t_uint8 has long
been a simple typedef for uint8_t.
If you make the change while targetting current Guile (2.2), then you'll
won't have deprecation warnings when 3.0 comes out.
Cheers,
Andy
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-06-29 7:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-23 20:12 c99 support Andy Wingo
2018-06-24 0:00 ` Chris Vine
2018-06-24 9:13 ` Arne Babenhauserheide
2018-06-29 7:39 ` Andy Wingo
[not found] <878t7548ta.fsf@pobox.com>
[not found] ` <83po0htihm.fsf@gnu.org>
[not found] ` <874lht4683.fsf@pobox.com>
2018-06-24 2:37 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).