* Why not C99 designated initializer syntax?
@ 2016-12-12 21:56 Daniel Colascione
2016-12-12 22:07 ` Philipp Stephani
2016-12-12 22:29 ` Paul Eggert
0 siblings, 2 replies; 4+ messages in thread
From: Daniel Colascione @ 2016-12-12 21:56 UTC (permalink / raw)
To: emacs-devel
Why are we writing code like this?
struct font_driver const nsfont_driver =
{
type: LISPSYM_INITIALLY (Qns),
case_sensitive: true,
...
};
and not like this?
struct font_driver const nsfont_driver =
{
.type = LISPSYM_INITIALLY (Qns),
.case_sensitive = true,
...
};
The former is a deprecated GCC extension. The latter is the standard.
We need C99 these days anyway.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Why not C99 designated initializer syntax?
2016-12-12 21:56 Why not C99 designated initializer syntax? Daniel Colascione
@ 2016-12-12 22:07 ` Philipp Stephani
2016-12-12 22:11 ` Daniel Colascione
2016-12-12 22:29 ` Paul Eggert
1 sibling, 1 reply; 4+ messages in thread
From: Philipp Stephani @ 2016-12-12 22:07 UTC (permalink / raw)
To: Daniel Colascione, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 652 bytes --]
Daniel Colascione <dancol@dancol.org> schrieb am Mo., 12. Dez. 2016 um
22:56 Uhr:
>
> Why are we writing code like this?
>
> struct font_driver const nsfont_driver =
> {
> type: LISPSYM_INITIALLY (Qns),
> case_sensitive: true,
> ...
> };
>
> and not like this?
>
> struct font_driver const nsfont_driver =
> {
> .type = LISPSYM_INITIALLY (Qns),
> .case_sensitive = true,
> ...
> };
>
> The former is a deprecated GCC extension. The latter is the standard.
> We need C99 these days anyway.
>
>
Probably just an accident. There doesn't seem to be a ban on C99 designated
initializers; for example, I've added some to emacs-module.c
[-- Attachment #2: Type: text/html, Size: 1406 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Why not C99 designated initializer syntax?
2016-12-12 22:07 ` Philipp Stephani
@ 2016-12-12 22:11 ` Daniel Colascione
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Colascione @ 2016-12-12 22:11 UTC (permalink / raw)
To: Philipp Stephani; +Cc: emacs-devel
On Mon, Dec 12 2016, Philipp Stephani wrote:
> Daniel Colascione <dancol@dancol.org> schrieb am Mo., 12. Dez. 2016 um 22:56 Uhr:
>
> Why are we writing code like this?
>
> struct font_driver const nsfont_driver =
> {
> type: LISPSYM_INITIALLY (Qns),
> case_sensitive: true,
> ...
> };
>
> and not like this?
>
> struct font_driver const nsfont_driver =
> {
> .type = LISPSYM_INITIALLY (Qns),
> .case_sensitive = true,
> ...
> };
>
> The former is a deprecated GCC extension. The latter is the standard.
> We need C99 these days anyway.
>
> Probably just an accident. There doesn't seem to be a ban on C99 designated initializers; for example, I've added
> some to emacs-module.c
An accident is possible. It's just curious that this syntax has
appeared in brand-new code.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Why not C99 designated initializer syntax?
2016-12-12 21:56 Why not C99 designated initializer syntax? Daniel Colascione
2016-12-12 22:07 ` Philipp Stephani
@ 2016-12-12 22:29 ` Paul Eggert
1 sibling, 0 replies; 4+ messages in thread
From: Paul Eggert @ 2016-12-12 22:29 UTC (permalink / raw)
To: Daniel Colascione, emacs-devel
On 12/12/2016 01:56 PM, Daniel Colascione wrote:
> Why are we writing code like this?
Because I remembered the old GNU C syntax, and forgot that C99
standardized on a different syntax. Sorry about that. Should be fixed now.
It is amusing that nobody noticed until now. I guess GNU C syntax is
pretty widely supported, even among non-GNU compilers.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-12-12 22:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-12 21:56 Why not C99 designated initializer syntax? Daniel Colascione
2016-12-12 22:07 ` Philipp Stephani
2016-12-12 22:11 ` Daniel Colascione
2016-12-12 22:29 ` Paul Eggert
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).