tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] 4 bugfixes for Rob Landley's revision 470


From: Rob Landley
Subject: Re: [Tinycc-devel] 4 bugfixes for Rob Landley's revision 470
Date: Wed, 5 Sep 2007 18:52:08 -0500
User-agent: KMail/1.9.6

On Wednesday 05 September 2007 6:22:48 pm Simon 'corecode' Schubert wrote:
> Rob Landley wrote:
> > Hmmm, could you give me some more information about the
> > handle_stray_noerror() thing?  It seems like rather than special-casing
> > \r\n, we might want to just handle any trailing whitespace after a \ line
> > extender?  (This isn't specific to your patch, this is the underlying
> > function being more brittle than I'm comfortable with.)
>
> I think this is a bad idea.  \r\n is some sort of broken \n, but " \n"
> for sure isn't.

Trailing whitespace is annoying because it's not visible to programmers, but 
if we're going to skip one kind of whitespace I don't see why not to skip all 
of 'em.

(Windows developers thing \r is _special_ whitespace.  I don't.)

> > Except that doesn't work, naievely because skip_spaces hasn't been
> > declared yet, but more fundamentally the because skip_spaces() doesn't
> > call inp(), it calls cinp().  What's cinp()?  It's a #define to minp(). 
> > (WHY???)  And minp(), of course, is defined as:
> >
> > static void minp(void)
> > {
> >     inp();
> >     if (ch == '\\')
> >         handle_stray();
> > }
> >
> > Congratulations, we have achieved recursion.
>
> You seem to be grumbling about tcc quite a bit, and I have to say the
> code isn't close to "nice".  Of course that's understandable,
> considering the origin of the source.

I grumble about everything, including stuff I wrote. :)

I plan to clean it up, as I get time, but that conditional's a doozy.

> Nevertheless I wonder if it might be a nice educational experience to
> write a new tcc (or however it would be called) from scratch, using nice
> function and variable names, a sane scoping (not everything as globals)
> and broken up into multiple files.  Of course that sounds like a lot of
> work as well :)

Feel free.  It would be about as much of an educational experience to morph 
the existing tcc into something with nice function and variable names, sane 
scoping, and broken up into multiple files.  You'll notice I already broke 
off a tcc.h from tcc.c.  That's the tip of the iceberg of what it _needs_...

> cheers
>    simon

Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]