Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #383844
| From | fir <fir@grunge.pl> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Block Comments Or Rest-Of-Line Comments? |
| Date | 2024-03-21 19:46 +0100 |
| Organization | i2pn2 (i2pn.org) |
| Message-ID | <uthva5$2k4da$1@i2pn2.org> (permalink) |
| References | <utgjh0$21nsq$2@dont-email.me> |
Lawrence D'Oliveiro wrote:
> The original comment delimiters in C were copied from PL/I: everything
> between “/*” and “*/” is a comment, even extending across multiple lines.
> Pascal had something similar, only the delimiters were “{” and “}”, or
> “(*” and “*)” for compatibility with machines with restricted character
> sets.
>
> For some reason, the Ada folks decided block comments were not a good
> idea, and so their rule was that anything after “--” up to the end of the
> line was a comment. And C++ adopted a similar rule, using “//” as their
> to-end-of-line comment marker, though of course they also kept C-style
> block comments. Java also keeps both these styles.
>
> Since then, I’ve seen newer programmers gravitate towards the rest-of-line
> form in preference to the block form, and I’m not sure why. I’m fond of
> writing things like
>
> /*
> A very simple HTML/XML entity-escape function--why isn’t this
> part of the standard Java API?
> */
>
> which involve less typing than
>
> //
> // A very simple HTML/XML entity-escape function--why isn’t this
> // part of the standard Java API?
> //
>
> Also, the “block” form allows “interspersed” comments, where a short
> comment can be put in the middle of a line and followed by more program
> text in the rest of the line. For example, as a way of keeping long
> argument lists straight:
>
> gdImageCopyResampled
> (
> /*dst =*/ ResizedFrame,
> /*src =*/ Context.StillFrame,
> /*dstX =*/ 0,
> /*dstY =*/ 0,
> /*srcX =*/ 0,
> /*srcY =*/ 0,
> /*dstW =*/ ResizedFrame->sx,
> /*dstH =*/ ResizedFrame->sy,
> /*srcW =*/ Context.StillFrame->sx,
> /*srcH =*/ Context.StillFrame->sy
> );
>
> Do you feel the same?
>
in practice i fint /* */ comments not handy - as bartc noted there is
clear bug thah they dont nest and this is specifically annoying
"i consider this type of comments personally";
the advantage of this above is they are kinda basic i mean c using them
and not using the other type is "thinner", they also felt liek more
physical - and eventually could be build in binary imo by some compiler
switch
i never seen anybody who ises it though, and i noticed that i can use it
but not yet decided - mostly i use // coments becouse i nearly
exclusively use comments to comment out code and in editor i got it
under control+shift+c
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar
Block Comments Or Rest-Of-Line Comments? Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-21 06:19 +0000
Re: Block Comments Or Rest-Of-Line Comments? bart <bc@freeuk.com> - 2024-03-21 09:39 +0000
Re: Block Comments Or Rest-Of-Line Comments? Mikko <mikko.levanto@iki.fi> - 2024-03-21 13:37 +0200
Re: Block Comments Or Rest-Of-Line Comments? Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-21 21:16 +0000
Re: Block Comments Or Rest-Of-Line Comments? David Brown <david.brown@hesbynett.no> - 2024-03-22 10:02 +0100
Re: Block Comments Or Rest-Of-Line Comments? Blue-Maned_Hawk <bluemanedhawk@invalid.invalid> - 2024-03-22 16:13 +0000
Re: Block Comments Or Rest-Of-Line Comments? Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-23 02:58 +0000
Re: Block Comments Or Rest-Of-Line Comments? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-22 21:15 -0700
Re: Block Comments Or Rest-Of-Line Comments? Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-23 04:44 +0000
Re: Block Comments Or Rest-Of-Line Comments? David Brown <david.brown@hesbynett.no> - 2024-03-23 16:24 +0100
Re: Block Comments Or Rest-Of-Line Comments? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2024-03-23 18:34 +0000
Re: Block Comments Or Rest-Of-Line Comments? scott@slp53.sl.home (Scott Lurndal) - 2024-03-21 14:16 +0000
Re: Block Comments Or Rest-Of-Line Comments? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-03-21 08:19 -0700
Re: Block Comments Or Rest-Of-Line Comments? cross@spitfire.i.gajendra.net (Dan Cross) - 2024-03-21 17:58 +0000
Re: Block Comments Or Rest-Of-Line Comments? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-03-22 06:27 -0700
Re: Block Comments Or Rest-Of-Line Comments? cross@spitfire.i.gajendra.net (Dan Cross) - 2024-03-22 23:16 +0000
Re: Block Comments Or Rest-Of-Line Comments? Blue-Maned_Hawk <bluemanedhawk@invalid.invalid> - 2024-03-21 14:19 +0000
Re: Block Comments Or Rest-Of-Line Comments? David Brown <david.brown@hesbynett.no> - 2024-03-21 16:20 +0100
Re: Block Comments Or Rest-Of-Line Comments? Richard Harnden <richard.nospam@gmail.invalid> - 2024-03-21 16:32 +0000
Re: Block Comments Or Rest-Of-Line Comments? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-03-21 12:23 -0700
Re: Block Comments Or Rest-Of-Line Comments? Richard Harnden <richard.nospam@gmail.invalid> - 2024-03-21 19:41 +0000
Re: Block Comments Or Rest-Of-Line Comments? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-03-21 12:48 -0700
Re: Block Comments Or Rest-Of-Line Comments? Richard Harnden <richard.nospam@gmail.invalid> - 2024-03-21 19:54 +0000
Re: Block Comments Or Rest-Of-Line Comments? Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-21 21:18 +0000
Re: Block Comments Or Rest-Of-Line Comments? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-03-21 15:50 -0700
Re: Block Comments Or Rest-Of-Line Comments? scott@slp53.sl.home (Scott Lurndal) - 2024-03-21 20:19 +0000
Re: Block Comments Or Rest-Of-Line Comments? Kaz Kylheku <433-929-6894@kylheku.com> - 2024-03-21 20:35 +0000
Re: Block Comments Or Rest-Of-Line Comments? Kaz Kylheku <433-929-6894@kylheku.com> - 2024-03-21 20:22 +0000
Re: Block Comments Or Rest-Of-Line Comments? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-03-21 15:41 -0700
Re: Block Comments Or Rest-Of-Line Comments? James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-03-22 12:20 -0400
Re: Block Comments Or Rest-Of-Line Comments? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-03-22 09:33 -0700
Re: Block Comments Or Rest-Of-Line Comments? Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-22 23:42 +0000
Re: Block Comments Or Rest-Of-Line Comments? David Brown <david.brown@hesbynett.no> - 2024-03-22 10:09 +0100
Re: Block Comments Or Rest-Of-Line Comments? fir <fir@grunge.pl> - 2024-03-21 19:46 +0100
Re: Block Comments Or Rest-Of-Line Comments? Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-21 21:14 +0000
Re: Block Comments Or Rest-Of-Line Comments? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2024-03-22 22:50 +0000
csiph-web