Path: utzoo!attcan!uunet!aplcen!jhunix!gwollman From: gwollman@jhunix.HCF.JHU.EDU (Garrett A Wollman) Newsgroups: comp.lang.c Subject: Re: Re^4: Why nested comments not allowed? Message-ID: <4298@jhunix.HCF.JHU.EDU> Date: 21 Feb 90 14:16:49 GMT References: <1525@wacsvax.OZ> <13771@cbnewsc.ATT.COM> Reply-To: gwollman@jhunix.UUCP (Garrett A Wollman) Organization: The Johns Hopkins University - otherwise none Lines: 29 In article <13771@cbnewsc.ATT.COM> dalenber@cbnewsc.ATT.COM (Russel Dalenberg) writes: >I said: how do you handle the case where the above line of legal C is >commented out. If it's not commented out, there is no problem. > >The "usual" way to comment out such code would be: > >/* printf("A comment is ended with */"); */ > >Since quotes have *NO* significance within comments, the above comment >ends with the first "*/" found; with *both* nested and non-nested comments! I was one of those people in Dan Barrett's class. My program has a simple hook which can be enabled (call it "STRINGINCOMM") which can handle such situations...AT A PRICE. In *EITHER* style, you can EITHER handle this situation correctly, or you can handle /* ho hum, this is a quote chatacter -->" */ correctly. Without knowing the programmer's intentions wrt comments, it is *impossible* to handle both cases correctly in the same decommenter. -GAWollman -- "All societies are based on rules to protect pregnant women and children. . . . As racial survival is the only universal morality, no other bases is possible." - Lazarus Long [RAH, _TEFL_] ---------------Hopkins doesn't *want* my opinions------------------------