🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2199

Re: C-formattors (problems with very long lines)

#2199
From: David E A Wilson
Date: Sat, 03 Oct 1992 05:45
24 lines
1380 bytes
hermann@uran.informatik.uni-bonn.de (Hermann Stamm) writes:
>Below you can find the little prog I am using. It detects both,
>if a ; is inside "..." and inside ' ' . If so, it doesn't insert
>the '\n' after the ; otherwise it does.
>The question now is, does the below program correctly transforms
>any compilable C-source into also compilable C-source.

Code deleted for brevity.

The short answer is no - your program fails on a set of programs
in which an odd number of ' or " appear inside " or ' or /* */.
For example:

main() { char *x = "';"; char y = ';'; char z = '"'; }

when run through your program results in:

main() { char *x = "';"; char y = ';
'; char z = '"'; }

Your code fails to break at the three valid `;' and breaks at one invalid `;'.
-- 
David Wilson				(042) 21 3802 voice, (042) 21 3262 fax
Dept Comp Sci, Uni of Wollongong	david@cs.uow.edu.au
Technical Details
Message-ID: <1992Oct3.054518.10493@cs.uow.edu.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!sol.ctr.columbia.edu!usc!rpi!batcomputer!munnari.oz.au!metro!cs.uow.edu.au!david
References: <1992Sep30.092907.28988@olymp.informatik.uni-bonn.de>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!sol.ctr.columbia.edu!usc!rpi!batcomputer!munnari.oz.au!metro!cs.uow.edu.au!david
From: david@cs.uow.edu.au (David E A Wilson)
Subject: Re: C-formattors (problems with very long lines)
Message-ID: <1992Oct3.054518.10493@cs.uow.edu.au>
Organization: Dept of Computer Science, Wollongong University, Australia
References: <1992Sep30.092907.28988@olymp.informatik.uni-bonn.de>
Date: Sat, 3 Oct 1992 05:45:18 GMT
Lines: 24