[comp.lang.c] Nested comments in VAX C -- Help!

RCAPENER@cc.utah.edu (05/06/91)

NOTE:  Please send any replies to bnelson@cc.weber.edu.  Thanx!


Does anyone know if it is possible to nest comments in VAX C?

Or is it even possible?


if you try  /* outside comment /* inside comment */ */
the compiler throws up!

Any ideas would be helpful.

Thanks!

bert nelson
weber state university
bnelson@cc.weber.edu

brendan@cs.widener.edu (Brendan Kehoe) (05/07/91)

In <114836@cc.utah.edu>, RCAPENER@cc.utah.edu writes:
>if you try  /* outside comment /* inside comment */ */
>the compiler throws up!

 As it should .. no compiler should let that through.
 When you "nest" comments, you have multiple starts (/*); the */
sequence tells cpp that it's the end of the comment, and it should
start paying attention again. The second */ is what it's throwing up on.

-- 
     Brendan Kehoe - Widener Sun Network Manager - brendan@cs.widener.edu
  Widener University in Chester, PA                A Bloody Sun-Dec War Zone
      "Does this person look relaxed to you?  Well, it's actually an
              experiment of Contour's new 565-E chair!"

sven@cs.widener.edu (Sven Heinicke) (05/08/91)

In <VHG+SRC@cs.widener.edu>, brendan@cs.widener.edu writes:
>In <114836@cc.utah.edu>, RCAPENER@cc.utah.edu writes:
>>if you try  /* outside comment /* inside comment */ */
>>the compiler throws up!
>
> As it should .. no compiler should let that through.
> When you "nest" comments, you have multiple starts (/*); the */
>sequence tells cpp that it's the end of the comment, and it should
>start paying attention again. The second */ is what it's throwing up on.
>

it is bad, I do a string-replace from */ to ^/ and string-replace it
back afterwards.

-- 
sven@cs.widener.edu                                  Widener CS system manager
Sven Mike Heinicke                                          and Student
(pssmheinicke@cyber.widener.edu (if you must))