Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #61655 > unrolled thread
| Started by | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| First post | 2015-05-06 18:54 -0700 |
| Last post | 2015-05-18 16:07 -0400 |
| Articles | 20 on this page of 122 — 13 participants |
Back to article view | Back to comp.lang.c
A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-06 18:54 -0700
A Note on Readability asetofsymbols@gmail.com - 2015-05-06 23:08 -0700
Re: A Note on Readability Richard Heathfield <rjh@cpax.org.uk> - 2015-05-07 07:34 +0100
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-07 12:22 -0700
Re: A Note on Readability raltbos@xs4all.nl (Richard Bos) - 2015-05-17 10:50 +0000
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-17 09:40 -0700
Re: A Note on Readability Richard Heathfield <rjh@cpax.org.uk> - 2015-05-17 18:06 +0100
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-18 10:38 -0700
Re: A Note on Readability James Kuyper <jameskuyper@verizon.net> - 2015-05-18 14:07 -0400
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-19 10:07 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-19 11:23 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-20 08:41 -0700
Re: A Note on Readability asetofsymbols@gmail.com - 2015-05-20 09:03 -0700
Re: A Note on Readability Les Cargill <lcargill99@comcast.com> - 2015-05-20 12:09 -0500
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-21 09:08 -0700
Re: A Note on Readability Richard Heathfield <rjh@cpax.org.uk> - 2015-05-20 17:15 +0100
Re: A Note on Readability Les Cargill <lcargill99@comcast.com> - 2015-05-20 12:10 -0500
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-21 08:58 -0700
Re: A Note on Readability glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-05-21 17:33 +0000
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-22 09:47 -0700
Re: A Note on Readability Les Cargill <lcargill99@comcast.com> - 2015-05-20 12:08 -0500
Re: A Note on Readability James Kuyper <jameskuyper@verizon.net> - 2015-05-20 13:43 -0400
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-20 10:59 -0700
Re: A Note on Readability Les Cargill <lcargill99@comcast.com> - 2015-05-20 18:05 -0500
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-20 17:36 -0700
Re: A Note on Readability Les Cargill <lcargill99@comcast.com> - 2015-05-20 22:12 -0500
Re: A Note on Readability Philip Lantz <prl@canterey.us> - 2015-05-20 20:34 -0700
Re: A Note on Readability glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-05-21 04:39 +0000
Re: A Note on Readability Philip Lantz <prl@canterey.us> - 2015-05-21 17:41 -0700
Re: A Note on Readability gwowen <gwowen@gmail.com> - 2015-05-21 01:14 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-21 09:26 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-21 10:33 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-22 09:42 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-22 11:53 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-23 10:01 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-23 14:53 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-24 09:18 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-24 13:13 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-25 09:38 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-25 12:40 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-26 10:56 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-26 12:35 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-27 10:08 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-27 11:07 -0700
Re: A Note on Readability Robert Wessel <robertwessel2@yahoo.com> - 2015-05-27 20:17 -0500
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-25 09:56 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-25 13:05 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-26 09:58 -0700
Re: A Note on Readability Richard Heathfield <rjh@cpax.org.uk> - 2015-05-26 18:16 +0100
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-26 10:55 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-26 12:11 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-26 12:01 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-27 09:58 -0700
Re: A Note on Readability Richard Heathfield <rjh@cpax.org.uk> - 2015-05-27 18:11 +0100
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-28 12:11 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-28 12:55 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-29 10:08 -0700
Re: A Note on Readability Richard Heathfield <rjh@cpax.org.uk> - 2015-06-01 18:54 +0100
Re: A Note on Readability Tim Rentsch <txr@alumni.caltech.edu> - 2015-07-10 11:29 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-07-11 09:06 -0700
Re: A Note on Readability Tim Rentsch <txr@alumni.caltech.edu> - 2015-07-11 13:42 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-07-12 09:20 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-07-12 11:24 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-07-13 08:48 -0700
Re: A Note on Readability James Kuyper <jameskuyper@verizon.net> - 2015-07-13 12:38 -0400
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-07-13 10:34 -0700
Re: A Note on Readability James Kuyper <jameskuyper@verizon.net> - 2015-07-13 14:43 -0400
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-07-13 12:18 -0700
Re: A Note on Readability James Kuyper <jameskuyper@verizon.net> - 2015-07-13 15:27 -0400
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-07-14 08:45 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-07-14 09:05 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-07-14 09:41 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-07-14 10:26 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-07-15 19:59 -0700
Re: A Note on Readability James Kuyper <jameskuyper@verizon.net> - 2015-07-14 12:25 -0400
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-07-13 13:46 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-07-14 08:33 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-07-13 11:17 -0700
Re: A Note on Readability Richard Damon <Richard@Damon-Family.org> - 2015-07-13 21:06 -0400
Re: A Note on Readability James Kuyper <jameskuyper@verizon.net> - 2015-07-13 22:38 -0400
Re: A Note on Readability Richard Damon <Richard@Damon-Family.org> - 2015-07-15 08:19 -0400
Re: A Note on Readability Tim Rentsch <txr@alumni.caltech.edu> - 2015-07-20 09:10 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-07-13 11:00 -0700
Re: A Note on Readability Tim Rentsch <txr@alumni.caltech.edu> - 2015-07-15 08:11 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-27 10:57 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-24 09:51 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-24 13:36 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-25 10:00 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-25 13:05 -0700
Re: A Note on Readability Philip Lantz <prl@canterey.us> - 2015-05-24 16:43 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-24 09:57 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-24 13:37 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-25 10:14 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-25 13:11 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-26 10:26 -0700
Re: A Note on Readability Richard Heathfield <rjh@cpax.org.uk> - 2015-05-26 18:38 +0100
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-26 12:24 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-27 10:06 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-27 11:05 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-26 10:38 -0700
Re: A Note on Readability Tim Rentsch <txr@alumni.caltech.edu> - 2015-05-24 07:01 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-24 09:58 -0700
Re: A Note on Readability Philip Lantz <prl@canterey.us> - 2015-05-25 00:45 -0700
Re: A Note on Readability Tim Rentsch <txr@alumni.caltech.edu> - 2015-07-10 11:09 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-21 09:04 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-21 10:36 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-22 09:56 -0700
Re: A Note on Readability Robert Wessel <robertwessel2@yahoo.com> - 2015-05-22 12:16 -0500
Re: A Note on Readability James Kuyper <jameskuyper@verizon.net> - 2015-05-22 14:14 -0400
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-23 09:49 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-22 11:55 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-22 11:58 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-20 10:26 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-18 11:08 -0700
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-19 10:09 -0700
Re: A Note on Readability Richard Heathfield <rjh@cpax.org.uk> - 2015-05-18 20:40 +0100
Re: A Note on Readability James Kuyper <jameskuyper@verizon.net> - 2015-05-17 14:34 -0400
Re: A Note on Readability David Kleinecke <dkleinecke@gmail.com> - 2015-05-18 10:40 -0700
Re: A Note on Readability Keith Thompson <kst-u@mib.org> - 2015-05-18 11:18 -0700
Re: A Note on Readability James Kuyper <jameskuyper@verizon.net> - 2015-05-18 14:33 -0400
Re: A Note on Readability Richard Heathfield <rjh@cpax.org.uk> - 2015-05-18 20:44 +0100
Re: A Note on Readability James Kuyper <jameskuyper@verizon.net> - 2015-05-18 16:07 -0400
Page 1 of 7 [1] 2 3 4 5 6 7 Next page →
| From | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| Date | 2015-05-06 18:54 -0700 |
| Subject | A Note on Readability |
| Message-ID | <1d72d1ba-3317-4725-bedd-698843ca9c35@googlegroups.com> |
I just observed that:
In a situation where there is an object with hidden data as in:
In the header (.h):
typedef struct _Foo Foo;
typedef struct _FooPrivate FooPrivate;
struct _Foo {
...
FooPrivate* priv;};
and in the body (.c):
struct _FooPrivate {
... };
Then instead of referring to the hidden data as
... x->priv->y ...
where x is Foo*, split it like this
FooPrivate* xp = x->priv;
... xp->y ...
A little thing but it seems to me to make for much more easily
read code.
[toc] | [next] | [standalone]
| From | asetofsymbols@gmail.com |
|---|---|
| Date | 2015-05-06 23:08 -0700 |
| Message-ID | <0f9297b6-2d4c-4d12-8e97-470027248f72@googlegroups.com> |
| In reply to | #61655 |
But names that begin with _ are not reserved to compiler?
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2015-05-07 07:34 +0100 |
| Message-ID | <mif10b$sum$1@dont-email.me> |
| In reply to | #61666 |
On 07/05/15 07:08, asetofsymbols@gmail.com wrote: > But names that begin with _ are > not reserved to compiler? Not all of them, but by far the best course is to avoid declaring any identifiers beginning with an underscore. That way, you /know/ you aren't breaking any rules. Although you have provided no context and haven't started your subject line with "Re:", I guess you're actually responding to someone else's article, in which they have used underscores to begin identifiers. This may be because they don't know the rules, but it may be because they are sketching out code that a compiler writer might use in, say, a library function. Without context, it isn't possible to say which. -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| Date | 2015-05-07 12:22 -0700 |
| Message-ID | <85343d47-257a-4403-9672-40991134ba13@googlegroups.com> |
| In reply to | #61667 |
On Wednesday, May 6, 2015 at 11:35:01 PM UTC-7, Richard Heathfield wrote: > On 07/05/15 07:08, asetofsymbols@gmail.com wrote: > > But names that begin with _ are > > not reserved to compiler? > > > Not all of them, but by far the best course is to avoid declaring any > identifiers beginning with an underscore. That way, you /know/ you > aren't breaking any rules. > > Although you have provided no context and haven't started your subject > line with "Re:", I guess you're actually responding to someone else's > article, in which they have used underscores to begin identifiers. This > may be because they don't know the rules, but it may be because they are > sketching out code that a compiler writer might use in, say, a library > function. Without context, it isn't possible to say which. > > -- > Richard Heathfield > Email: rjh at cpax dot org dot uk > "Usenet is a strange place" - dmr 29 July 1999 > Sig line 4 vacant - apply within It's the style used in GTK+ (I used a cut-and-paste from gedit in fact under the impression that gedit should be considered part of GTK+)
[toc] | [prev] | [next] | [standalone]
| From | raltbos@xs4all.nl (Richard Bos) |
|---|---|
| Date | 2015-05-17 10:50 +0000 |
| Message-ID | <55587201.6548218@news.xs4all.nl> |
| In reply to | #61715 |
David Kleinecke <dkleinecke@gmail.com> wrote: > On Wednesday, May 6, 2015 at 11:35:01 PM UTC-7, Richard Heathfield wrote: > > On 07/05/15 07:08, asetofsymbols@gmail.com wrote: > > > But names that begin with _ are > > > not reserved to compiler? > > > > Not all of them, but by far the best course is to avoid declaring any > > identifiers beginning with an underscore. That way, you /know/ you > > aren't breaking any rules. > > > > Although you have provided no context and haven't started your subject > > line with "Re:", I guess you're actually responding to someone else's > > article, in which they have used underscores to begin identifiers. This > > may be because they don't know the rules, but it may be because they are > > sketching out code that a compiler writer might use in, say, a library > > function. Without context, it isn't possible to say which. > It's the style used in GTK+ (I used a cut-and-paste from gedit in fact > under the impression that gedit should be considered part of GTK+) If GTK+ is meant to be part of the implementation, that's allowed. If it's meant to be treated as a normal user library, it's not. (Some identifiers starting with _ are allowed in some circumstances, but the code in question used _ followed by a capital letter, which is reserved for the implementation in all cases. And anyway, it's better to err on the safe side, usually.) Richard
[toc] | [prev] | [next] | [standalone]
| From | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| Date | 2015-05-17 09:40 -0700 |
| Message-ID | <67b5daac-4378-458c-a6d0-fbf4e20d8340@googlegroups.com> |
| In reply to | #62149 |
On Sunday, May 17, 2015 at 3:51:21 AM UTC-7, Richard Bos wrote: > David Kleinecke <dkleinecke@gmail.com> wrote: > > > On Wednesday, May 6, 2015 at 11:35:01 PM UTC-7, Richard Heathfield wrote: > > > On 07/05/15 07:08, asetofsymbols@gmail.com wrote: > > > > But names that begin with _ are > > > > not reserved to compiler? > > > > > > Not all of them, but by far the best course is to avoid declaring any > > > identifiers beginning with an underscore. That way, you /know/ you > > > aren't breaking any rules. > > > > > > Although you have provided no context and haven't started your subject > > > line with "Re:", I guess you're actually responding to someone else's > > > article, in which they have used underscores to begin identifiers. This > > > may be because they don't know the rules, but it may be because they are > > > sketching out code that a compiler writer might use in, say, a library > > > function. Without context, it isn't possible to say which. > > > It's the style used in GTK+ (I used a cut-and-paste from gedit in fact > > under the impression that gedit should be considered part of GTK+) > > If GTK+ is meant to be part of the implementation, that's allowed. If > it's meant to be treated as a normal user library, it's not. > (Some identifiers starting with _ are allowed in some circumstances, but > the code in question used _ followed by a capital letter, which is > reserved for the implementation in all cases. And anyway, it's better to > err on the safe side, usually.) > > Richard You have set of rules you imagine I should follow. I don't think they are part of the C language.
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2015-05-17 18:06 +0100 |
| Message-ID | <mjahod$923$1@dont-email.me> |
| In reply to | #62177 |
On 17/05/15 17:40, David Kleinecke wrote: > On Sunday, May 17, 2015 at 3:51:21 AM UTC-7, Richard Bos wrote: >> David Kleinecke <dkleinecke@gmail.com> wrote: >> >> > On Wednesday, May 6, 2015 at 11:35:01 PM UTC-7, Richard Heathfield wrote: >> > > On 07/05/15 07:08, asetofsymbols@gmail.com wrote: >> > > > But names that begin with _ are >> > > > not reserved to compiler? >> > > >> > > Not all of them, but by far the best course is to avoid declaring any >> > > identifiers beginning with an underscore. That way, you /know/ you >> > > aren't breaking any rules. >> > > >> > > Although you have provided no context and haven't started your subject >> > > line with "Re:", I guess you're actually responding to someone else's >> > > article, in which they have used underscores to begin identifiers. This >> > > may be because they don't know the rules, but it may be because they are >> > > sketching out code that a compiler writer might use in, say, a library >> > > function. Without context, it isn't possible to say which. >> >> > It's the style used in GTK+ (I used a cut-and-paste from gedit in fact >> > under the impression that gedit should be considered part of GTK+) >> >> If GTK+ is meant to be part of the implementation, that's allowed. If >> it's meant to be treated as a normal user library, it's not. >> (Some identifiers starting with _ are allowed in some circumstances, but >> the code in question used _ followed by a capital letter, which is >> reserved for the implementation in all cases. And anyway, it's better to >> err on the safe side, usually.) >> > You have set of rules you imagine I should follow. I don't think they > are part of the C language. You are mistaken. The naming rules /are/ part of the C language. See for example 4.1.2 of C89 or Section 7.1.3 of C99 onwards. -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| Date | 2015-05-18 10:38 -0700 |
| Message-ID | <29103fb2-ce27-4c7f-a189-8ff170f5e246@googlegroups.com> |
| In reply to | #62182 |
On Sunday, May 17, 2015 at 10:06:31 AM UTC-7, Richard Heathfield wrote: > On 17/05/15 17:40, David Kleinecke wrote: > > On Sunday, May 17, 2015 at 3:51:21 AM UTC-7, Richard Bos wrote: > >> David Kleinecke <dkleinecke@gmail.com> wrote: > >> > >> > On Wednesday, May 6, 2015 at 11:35:01 PM UTC-7, Richard Heathfield wrote: > >> > > On 07/05/15 07:08, asetofsymbols@gmail.com wrote: > >> > > > But names that begin with _ are > >> > > > not reserved to compiler? > >> > > > >> > > Not all of them, but by far the best course is to avoid declaring any > >> > > identifiers beginning with an underscore. That way, you /know/ you > >> > > aren't breaking any rules. > >> > > > >> > > Although you have provided no context and haven't started your subject > >> > > line with "Re:", I guess you're actually responding to someone else's > >> > > article, in which they have used underscores to begin identifiers. This > >> > > may be because they don't know the rules, but it may be because they are > >> > > sketching out code that a compiler writer might use in, say, a library > >> > > function. Without context, it isn't possible to say which. > >> > >> > It's the style used in GTK+ (I used a cut-and-paste from gedit in fact > >> > under the impression that gedit should be considered part of GTK+) > >> > >> If GTK+ is meant to be part of the implementation, that's allowed. If > >> it's meant to be treated as a normal user library, it's not. > >> (Some identifiers starting with _ are allowed in some circumstances, but > >> the code in question used _ followed by a capital letter, which is > >> reserved for the implementation in all cases. And anyway, it's better to > >> err on the safe side, usually.) > >> > > You have set of rules you imagine I should follow. I don't think they > > are part of the C language. > > You are mistaken. The naming rules /are/ part of the C language. See for > example 4.1.2 of C89 or Section 7.1.3 of C99 onwards. > > -- > Richard Heathfield > Email: rjh at cpax dot org dot uk > "Usenet is a strange place" - dmr 29 July 1999 > Sig line 4 vacant - apply within In my copy of the C90 standard there is no 4.1.2. and Part 4 - entitled Compliance - does not discuss naming rules. I haven't looked at any later standard. If there are naming rules in C99 I am surprised and will take more care to mention version numbers.
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Date | 2015-05-18 14:07 -0400 |
| Message-ID | <555A2A66.1040201@verizon.net> |
| In reply to | #62227 |
On 05/18/2015 01:38 PM, David Kleinecke wrote: > On Sunday, May 17, 2015 at 10:06:31 AM UTC-7, Richard Heathfield wrote: ... >> You are mistaken. The naming rules /are/ part of the C language. See for >> example 4.1.2 of C89 or Section 7.1.3 of C99 onwards. ... > In my copy of the C90 standard there is no 4.1.2. and Part 4 - entitled > Compliance - does not discuss naming rules. C90 differs from C89 almost entirely by the addition of 3 sections at the beginning required by ISO document conventions, with the result that all other section numbers increased by 3. Thus, section 4.1.2 of C89 would correspond to 7.1.2 of C90. I don't have a copy of either standard, so I cannot confirm that either section number is correct, but it is section 7.1.3 in later versions of the standard, which I do have copies of, so that puts it in the right general region of the document.
[toc] | [prev] | [next] | [standalone]
| From | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| Date | 2015-05-19 10:07 -0700 |
| Message-ID | <70adeda1-3b83-4a96-b57b-59ac062f0bc6@googlegroups.com> |
| In reply to | #62232 |
On Monday, May 18, 2015 at 11:07:42 AM UTC-7, James Kuyper wrote: > On 05/18/2015 01:38 PM, David Kleinecke wrote: > > On Sunday, May 17, 2015 at 10:06:31 AM UTC-7, Richard Heathfield wrote: > ... > >> You are mistaken. The naming rules /are/ part of the C language. See for > >> example 4.1.2 of C89 or Section 7.1.3 of C99 onwards. > ... > > In my copy of the C90 standard there is no 4.1.2. and Part 4 - entitled > > Compliance - does not discuss naming rules. > > C90 differs from C89 almost entirely by the addition of 3 sections at > the beginning required by ISO document conventions, with the result that > all other section numbers increased by 3. Thus, section 4.1.2 of C89 > would correspond to 7.1.2 of C90. I don't have a copy of either > standard, so I cannot confirm that either section number is correct, but > it is section 7.1.3 in later versions of the standard, which I do have > copies of, so that puts it in the right general region of the document. In the C90 standard Part 7 is the Library. 7.1.2 describes Standard headers and 7.1.3 is about Reserved Headers does is in fact what you wanted. Since I was copying GTK+ code and not advancing my own I don't feel very apologetic. Personally I never start a name with an underscore. Since GTK+ compiles (I assume) either gcc (assumed) does not enforce the rules about reserved headers or has a way to turn the enforcement off. I assume it is the standards committee that wants to keep the reserved headers to themselves.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2015-05-19 11:23 -0700 |
| Message-ID | <87oalg2zq0.fsf@kst-u.example.com> |
| In reply to | #62305 |
David Kleinecke <dkleinecke@gmail.com> writes:
> On Monday, May 18, 2015 at 11:07:42 AM UTC-7, James Kuyper wrote:
>> On 05/18/2015 01:38 PM, David Kleinecke wrote:
>> > On Sunday, May 17, 2015 at 10:06:31 AM UTC-7, Richard Heathfield wrote:
>> ...
>> >> You are mistaken. The naming rules /are/ part of the C language. See for
>> >> example 4.1.2 of C89 or Section 7.1.3 of C99 onwards.
>> ...
>> > In my copy of the C90 standard there is no 4.1.2. and Part 4 - entitled
>> > Compliance - does not discuss naming rules.
>>
>> C90 differs from C89 almost entirely by the addition of 3 sections at
>> the beginning required by ISO document conventions, with the result that
>> all other section numbers increased by 3. Thus, section 4.1.2 of C89
>> would correspond to 7.1.2 of C90. I don't have a copy of either
>> standard, so I cannot confirm that either section number is correct, but
>> it is section 7.1.3 in later versions of the standard, which I do have
>> copies of, so that puts it in the right general region of the document.
>
> In the C90 standard Part 7 is the Library. 7.1.2 describes Standard
> headers and 7.1.3 is about Reserved Headers does is in fact what you
> wanted.
>
> Since I was copying GTK+ code and not advancing my own I don't feel very
> apologetic. Personally I never start a name with an underscore. Since
> GTK+ compiles (I assume) either gcc (assumed) does not enforce the rules
> about reserved headers or has a way to turn the enforcement off.
There are no rules to enforce. The standard says that code outside the
implementation that uses identifiers that are reserved to the
implementation has undefined behavior. There is no requirement for
compilers to detect or diagnose improper use of reserved identifiers.
If I write (assume this is part of a complete program):
int n = 42;
printf("%d\n", n);
it must print "42", or at least try to do so (assuming a conforming
hosted implementation). If I write:
int _N = 42;
printf("%d\n", _N);
the behavior is undefined. One very likely result is that it will print
"42". Another possible result is that it will fail to compile because
<stdio.h> or the compiler uses _N for its own purposes.
> I assume it is the standards committee that wants to keep the reserved
> headers to themselves.
You make it sound like the committee is hoarding identifiers for
some nefarious purpose. I wouldn't put it that way. The standards
committee wants to keep a particular set of identifiers reserved
for implementers, guaranteeing that other identifiers are available
for use in user code. This is primarily for the benefit of C
programmers, who can depend on being able to use non-reserved
identifiers without fear of collisions (though collisions with
library code are still possible).
I asked you a few days ago:
[...] Do you think that identifiers starting with underscores
*shouldn't* be reserved to the implementation? If so, how are
implementations of the standard library supposed to be written
without the risk of breaking user code?
I don't recall that you ever replied.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| Date | 2015-05-20 08:41 -0700 |
| Message-ID | <792ce9c8-075c-4b19-8a2f-ac75dab1a178@googlegroups.com> |
| In reply to | #62314 |
On Tuesday, May 19, 2015 at 11:23:48 AM UTC-7, Keith Thompson wrote: > David Kleinecke <dkleinecke@gmail.com> writes: > I asked you a few days ago: > > [...] Do you think that identifiers starting with underscores > *shouldn't* be reserved to the implementation? If so, how are > implementations of the standard library supposed to be written > without the risk of breaking user code? > > I don't recall that you ever replied. I didn't reply. Yes - I don't think there should be any reserved identifiers. If people have been obeying the rules so far there is no user code to break by abolishing identifier reservation. Future conflicts between identifiers in the standard library can be handled in whatever fashion conflicts between identifiers in two pieces of user code are handled. There is nothing sacred about the standard library any more. And, while I am at it - I think <> includes should be abolished or, better, made identical to "" includes. All the <> ever provided was the ability to give short standard library file names by implying "look in the directory where the standard library is."
[toc] | [prev] | [next] | [standalone]
| From | asetofsymbols@gmail.com |
|---|---|
| Date | 2015-05-20 09:03 -0700 |
| Message-ID | <19597795-6ef4-43ff-8a2a-4adbed1b64fe@googlegroups.com> |
| In reply to | #62344 |
David wrote: "I don't think there should be any reserved identifiers." In the compiler I have here _EAX is a name compiler use I don't know what could happen if I write: double _EAX=0.0;
[toc] | [prev] | [next] | [standalone]
| From | Les Cargill <lcargill99@comcast.com> |
|---|---|
| Date | 2015-05-20 12:09 -0500 |
| Message-ID | <mjien9$f7c$2@dont-email.me> |
| In reply to | #62351 |
asetofsymbols@gmail.com wrote: > David wrote: > "I don't think there should be any reserved identifiers." > > In the compiler I have here > _EAX > is a name compiler use > I don't know what could happen if > I write: > double _EAX=0.0; > http://reikna.skjabjort.is/wp-content/uploads/2012/07/divide-by-zero1.jpg -- Les Cargill
[toc] | [prev] | [next] | [standalone]
| From | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| Date | 2015-05-21 09:08 -0700 |
| Message-ID | <7dc1d6f8-a8f9-48d9-b3cb-a1606b855f6c@googlegroups.com> |
| In reply to | #62351 |
On Wednesday, May 20, 2015 at 9:03:32 AM UTC-7, asetof...@gmail.com wrote:
> David wrote:
> "I don't think there should be any reserved identifiers."
>
> In the compiler I have here
> _EAX
> is a name compiler use
> I don't know what could happen if
> I write:
> double _EAX=0.0;
I don't know what your compiler does buut the result should be about the
same as writing
return = 0.0
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2015-05-20 17:15 +0100 |
| Message-ID | <mjibtk$3tn$1@dont-email.me> |
| In reply to | #62344 |
On 20/05/15 16:41, David Kleinecke wrote: > I don't think there should be any reserved identifiers. If you think this is a flaw in the Standard, you can raise a DR. If you think it's a flaw in the language, you can lobby in comp.std.c. Lobbying here won't do any good, because here we discuss the language defined by the Standard. Still, we might as well hear it. *Why* don't you think there should be any reserved identifiers? -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | Les Cargill <lcargill99@comcast.com> |
|---|---|
| Date | 2015-05-20 12:10 -0500 |
| Message-ID | <mjiep5$f7c$3@dont-email.me> |
| In reply to | #62352 |
Richard Heathfield wrote: > On 20/05/15 16:41, David Kleinecke wrote: >> I don't think there should be any reserved identifiers. > > If you think this is a flaw in the Standard, you can raise a DR. If you > think it's a flaw in the language, you can lobby in comp.std.c. Lobbying > here won't do any good, because here we discuss the language defined by > the Standard. > > Still, we might as well hear it. POR QUE?!??!? *Why* don't you think there should be > any reserved identifiers? > <makes popcorn> -- Les Cargill
[toc] | [prev] | [next] | [standalone]
| From | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| Date | 2015-05-21 08:58 -0700 |
| Message-ID | <e13e9f30-f363-4ff5-b7fc-5ba6acf910d9@googlegroups.com> |
| In reply to | #62352 |
On Wednesday, May 20, 2015 at 9:16:00 AM UTC-7, Richard Heathfield wrote: > On 20/05/15 16:41, David Kleinecke wrote: > > I don't think there should be any reserved identifiers. > > If you think this is a flaw in the Standard, you can raise a DR. If you > think it's a flaw in the language, you can lobby in comp.std.c. Lobbying > here won't do any good, because here we discuss the language defined by > the Standard. > > Still, we might as well hear it. *Why* don't you think there should be > any reserved identifiers? I am not interested in changing the standard. The reason I don't think there should be any reserved identifiers is that I don't see any necessity for them and want frills removed.
[toc] | [prev] | [next] | [standalone]
| From | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
|---|---|
| Date | 2015-05-21 17:33 +0000 |
| Message-ID | <mjl4t4$suh$1@speranza.aioe.org> |
| In reply to | #62411 |
David Kleinecke <dkleinecke@gmail.com> wrote: > On Wednesday, May 20, 2015 at 9:16:00 AM UTC-7, Richard Heathfield wrote: (snip) >> Still, we might as well hear it. *Why* don't you think there should be >> any reserved identifiers? > I am not interested in changing the standard. > The reason I don't think there should be any reserved identifiers is > that I don't see any necessity for them and want frills removed. Personally, I do prefer languages designed not to need reserved identifiers, but it won't happen in C. Too many statements look like function calls. It is an advantage of reserved identifiers that you can do bare function calls without a specific keyword. For Fortran and PL/I, two languages without reserved identifiers, you need a CALL keyword to call a subroutine. Function calls are in an expression context, including the right side of an assignment. -- glen
[toc] | [prev] | [next] | [standalone]
| From | David Kleinecke <dkleinecke@gmail.com> |
|---|---|
| Date | 2015-05-22 09:47 -0700 |
| Message-ID | <e9654970-ecf6-4d56-af7f-a7541cbb82c2@googlegroups.com> |
| In reply to | #62419 |
On Thursday, May 21, 2015 at 10:33:36 AM UTC-7, glen herrmannsfeldt wrote: > David Kleinecke <dkleinecke@gmail.com> wrote: > > On Wednesday, May 20, 2015 at 9:16:00 AM UTC-7, Richard Heathfield wrote: > (snip) > >> Still, we might as well hear it. *Why* don't you think there should be > >> any reserved identifiers? > > > I am not interested in changing the standard. > > > The reason I don't think there should be any reserved identifiers is > > that I don't see any necessity for them and want frills removed. > > Personally, I do prefer languages designed not to need reserved > identifiers, but it won't happen in C. Too many statements look > like function calls. > > It is an advantage of reserved identifiers that you can do bare > function calls without a specific keyword. > > For Fortran and PL/I, two languages without reserved identifiers, > you need a CALL keyword to call a subroutine. Function calls are > in an expression context, including the right side of an assignment. I don't follow you very well. Are you talking about "if (...), while (...) etc.? These are keywords not reserved words.
[toc] | [prev] | [next] | [standalone]
Page 1 of 7 [1] 2 3 4 5 6 7 Next page →
Back to top | Article view | comp.lang.c
csiph-web