🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6325

Re: language commenting constructs

#6325
From: Michael Beede
Date: Sat, 18 Mar 1989 04:42
49 lines
2478 bytes
>>         LET min2(a,b) = a < b -> a,b
>
>Take your pick:
>
>	min2(a,b) { return (a < b) ? a : b; }
>	#define min2(a,b) (((a) < (b)) ? (a) : (b))

Of course, these are only moderately similar.  Using the latter, what
is the result of

  a = 10;
  b = 20;
  c = return min2( a++, b-- );

In the case of a true function, the values of the variables are a=11,
b=19, c=10.  In the case of a macro, the result is a=12, b=19, c=11.

If it looks like a function it should _be_ a function.  (Now there's a
religious issue for you!)  Macros are chiefly used in C to substitue
for constants and to make up for a lack of inline functions.  Most C
programmers would be happy to never see another macro if they could
use inline functions.  Also, it is a real pain stepping through a
macro with a source-level debugger (or for that matter trying to
locate a syntax error in a nested macro).

On the comment issue, nested comments might be nice, but what would be
nicer would be comments with single-character delimiters.  It is
always frustrating to add something to a program, say inside about 5
levels of braces, like

    Call_Messy_Patch( 0, i, *(Desc->Func)( Q ) ); /* recover from  */
                                                  /* missing semi- */
						  /* colon         * /

and try to figure out why the compiler insists there is a syntax error
on some line 60 past where the change was made.  But, of course, REAL
PROGRAMMERS LIVE WITH THEIR TYPOS! ;-)  Since nearly every ascii
character in C is either part of an identifier, a constant, or an
operator, I have no suggestion for what that language could use.  I
guess what we need is a few more types of matching brace kind of 
characters to go along with <{[()]}>!

---


Mike Beede -- Secure Computing Technology Center MN55-7282
Honeywell Systems & Research Center              (612) 782-7147
2855 Anthony Lane South - Suite 130
Minneapolis MN                                   beede@src.honeywell.com
Technical Details
Message-ID: <18972@srcsip.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!csd4.milw.wisc.edu!srcsip!pavo!beede
References: <1543@zen.UUCP> <10460@lanl.gov> <39273@oliveb.olivetti.com> <3452@ficc.uu.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!csd4.milw.wisc.edu!srcsip!pavo!beede
From: beede@pavo.SRC.Honeywell.COM (Michael Beede)
Newsgroups: comp.lang.misc
Subject: Re: language commenting constructs
Message-ID: <18972@srcsip.UUCP>
Date: 18 Mar 89 04:42:31 GMT
References: <1543@zen.UUCP> <10460@lanl.gov> <39273@oliveb.olivetti.com> <3452@ficc.uu.net>
Sender: news@src.honeywell.COM
Lines: 49
In-reply-to: peter@ficc.uu.net's message of 16 Mar 89 15:56:21 GMT