|
![](/i/fill.gif) |
david sharp wrote:
> In tokenize.c, if I replace Fopen_Ungetc() with the following code,
> MegaPov works on MS-DOS style scene files.
> This is an inelegant way to go about it, but arf.
>
> /***********************/
> #ifdef __GO32__
> static void Fopen_Ungetc (DATA_FILE *File, int Ch)
> {
> if(Ch=='\n')
> ungetc ('\r', (FILE *) File->Data);
> ungetc (Ch, (FILE *) File->Data);
> }
> #else
> static void Fopen_Ungetc (DATA_FILE *File, int Ch)
> {
> ungetc (Ch, (FILE *) File->Data);
> }
> #endif
> /***********************/
Could I bug you to try to always use braces, even for single line
bodies?
{
if(Ch=='\n') {
ungetc ('\r', (FILE *) File->Data);
}
ungetc (Ch, (FILE *) File->Data);
}
As opposed to some things that are just a matter of style ( e.g. where
you decide to place them), always using braces even for single line
bodies is a good idea that helps prevent problems. Sometimes it's
possible to write logic incorrectly and miss it due to misleading
indention, but braces would catch that. Also, there are times when what
you thought was a simple function might actually change to be a
multi-line macro... and if so, BOOM! And many more details, but I'll
hold those for later discussion, if needed.
--
"My new computer's got the clocks, it rocks
But it was obsolete before I opened the box" - W.A.Y.
Post a reply to this message
|
![](/i/fill.gif) |