Deutsch   English   Français   Italiano  
<20240423134934.699@kylheku.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder6.news.weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.lang.c
Subject: Re: Block Comments Or Rest-Of-Line Comments?
Date: Tue, 23 Apr 2024 21:06:54 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <20240423134934.699@kylheku.com>
References: <utgjh0$21nsq$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 23 Apr 2024 23:06:54 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="b97e0bf93e1a92379ff802d120b7449c";
	logging-data="1951389"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+R0ceQQWukfm6hvXeLSSl/R4UDlDPn/p0="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:ep3nHzrhp1wbyrd1e0ireSFdMZ8=
Bytes: 3153

On 2024-03-21, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
> 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?

A normal person won't compulsively comment very function argument,
but if they had to do it, here is what it might look like:

      gdImageCopyResampled(ResizedFrame,                // dst
                           Context.StillFrame,          // src
                           0, 0, 0, 0,                  // {dst,src}{X,Y}
                           ResizedFrame->sx,            // dstW
                           ResizedFrame->sy,            // dstH
                           Context.StillFrame->sx,      // srcW
                           Context.StillFrame->sy);     // srcH

      gdImageCopyResampled(ResizedFrame,                /* dst */
                           Context.StillFrame,          /* src */
                           0, 0, 0, 0,                  /* {dst,src}{X,Y} */
                           ResizedFrame->sx,            /* dstW */
                           ResizedFrame->sy,            /* dstH */
                           Context.StillFrame->sx,      /* srcW */
                           Context.StillFrame->sy);     /* srcH */

Using either kind of comment, it goes at the end of the line, with a
decent amount of space. The reader of the code who doesn't find
the comments helpful can easily ignore them.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca