Deutsch English Français Italiano |
<uthva5$2k4da$1@i2pn2.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder6.news.weretis.net!i2pn.org!i2pn2.org!.POSTED!not-for-mail From: fir <fir@grunge.pl> Newsgroups: comp.lang.c Subject: Re: Block Comments Or Rest-Of-Line Comments? Date: Thu, 21 Mar 2024 19:46:29 +0100 Organization: i2pn2 (i2pn.org) Message-ID: <uthva5$2k4da$1@i2pn2.org> References: <utgjh0$21nsq$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 21 Mar 2024 18:46:29 -0000 (UTC) Injection-Info: i2pn2.org; logging-data="2757034"; mail-complaints-to="usenet@i2pn2.org"; posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0"; User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24 X-Spam-Checker-Version: SpamAssassin 4.0.0 In-Reply-To: <utgjh0$21nsq$2@dont-email.me> Bytes: 3455 Lines: 66 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