🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2265

Re: comment style

#2265
From: Leif Andrew Rump
Date: Wed, 09 Jan 1991 10:15
48 lines
2199 bytes
In <10690@darkstar.ucsc.edu> funkstr@ucscb.UCSC.EDU (Larry Hastings) writes:
>As for /* */ style comments, I'd just use /*/ for both ends if I could
>get away with it.  This makes it possible to have a single keymacro that emits
>both the begin and end comment markers.  Comments would now look like:

>	printf("\n");  /*/ I'm commenting this line for no reason /*/

>This works quite well with all the compilers I have handy.  The only reason I
>don't do this is because I'm afraid my coworkers would form a lynch mob.

Well our Sun C compiler which sure _isn't_ ANSI C compatible allow quite a
few things:

#include <stdio.h>

main()
{
  int   my/* Comments is _not_ considered as a white space */var;
/*
/* // It doesn't detect nested comments
  fprintf(stderr, "Hello");
/*/
  fprintf(stderr, " World");
/*/
  fprintf(stderr, "\n");
*/ 
  myvar = 1;
}

>p.s. I'm kidding about the /*/ comment markers, in case you can't tell -- but
>     I may work them in to an obfuscated C code contest entry

Does you C compiler not allow it or do You consider it bad programming?  :-)

The above code compiled on a Sun producing " World" as output. And the
comment toggling is a neat feature!!!  :-)  :-/  :-(  8-(  *-(  [Sigh]


Leif Andrew


Leif Andrew Rump, AmbraSoft A/S, Stroedamvej 50, DK-2100 Copenhagen OE, Denmark
UUCP: andrew@ambra.dk, phone: +45 39 27 11 77                /
Currently at Scandinavian Airline Systems                =======/
UUCP: andrew@resam.dk, phone: +45 32 32 51 54                \
SAS, RESAM Project Office, CPHML-V, P.O.BOX 150, DK-2770 Kastrup, Denmark

> > Read oe as: o <backspace> / (slash) and OE as O <backspace> / (slash) < <
Technical Details
Message-ID: <1991Jan9.101524.19424@resam.dk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!dkuug!resam!andrew
References: <1991Jan04.164355.15674@sco.COM> <1991Jan05.194321.12428@kithrup.COM> <10690@darkstar.ucsc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!dkuug!resam!andrew
From: andrew@resam.dk (Leif Andrew Rump)
Newsgroups: comp.std.c
Subject: Re: comment style
Message-ID: <1991Jan9.101524.19424@resam.dk>
Date: 9 Jan 91 10:15:24 GMT
References: <1991Jan04.164355.15674@sco.COM> <1991Jan05.194321.12428@kithrup.COM> <10690@darkstar.ucsc.edu>
Organization: RESAM Project Office, SAS, CPHML-V
Lines: 48