Re: A Readable C Code without #DEFINEs ...
- From: Simon Bone <sf.bone@xxxxxxxxxxxxxx>
- Date: Tue, 25 Oct 2005 09:26:35 -0000
On Wed, 19 Oct 2005 18:01:26 +0000, Bahram wrote:
> Folks,
>
> I am using LEX and YACC and they produce this grossly unreadable C code
> that is infested with #define this and #define that.
>
So don't read it. It was produced for the compiler to read, not for
humans.
> The code is unreadable and I need to make changes to it for the
> particular project I am working on.
>
Hopefully the input files are readable, and you can change those.
If the output was a true one off, modifying it might be acceptable, but
that is a very rare case. Imagine if you modified the output and someone
else then changed the input files and reran lex/yacc. How would you fix
the resulting mess?
If you read up on lex/yacc you will probably find a way to get it to do
what you want. E.g. you can put in declarations of variables/functions of
your own at the top of the files and refer to them in rules later on.
> Is there a switch is C, or, if you know about a hidden switch in either
> lex or yacc, that would produce a final human readable code that I can
> make sense out of, PLEASE.
>
If you really want to eliminate the pre-processor parts, you could look at
your compiler documentation. gcc (and others IIRC)offer a -E switch to do
this. But it is unlikely the results would qualify as human readable.
HTH
Simon Bone
--
comp.lang.c.moderated - moderation address: clcm@xxxxxxxxxxxx -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
.
- References:
- A Readable C Code without #DEFINEs ...
- From: Bahram
- A Readable C Code without #DEFINEs ...
- Prev by Date: Re: 'this' is not C
- Next by Date: Re: A Readable C Code without #DEFINEs ...
- Previous by thread: A Readable C Code without #DEFINEs ...
- Next by thread: Re: A Readable C Code without #DEFINEs ...
- Index(es):
Relevant Pages
|