2009/3/11 Gene Kwiecinski <[email protected]>:
>
>>>His indentation of opening braces is inconsistent.
>
>>Yes, but it's clearer (to me) than
>>for (;;)
>>{CallFunction();}
>
> Might be academic at this point, but for a single *statement* (not line)
> following a for(), if(), while(), etc., enclosing braces are *not*
> required. So
>
> for(;;)
> CallFunction();
>
> would be sufficient. Similarly,
>
> if( condition ) DoStuff(); else DoSomethingElse();
>
> works fine. Only if you'd want to do something funky like
>
> for(;;)
> { DoThis(); DoThat(); DoSomethingElseToo(); }
>
> would that style be <coff!> "required".
I realise this, but all C software that I write must be compliant with
the MISRA-C guidelines for the use of the C language in critical
systems, which has rules 14.8/9 which read something along the lines
of:
"The statement forming the body of an if, else if, else, while, do ...
while or for statement shall always be enclosed in braces"
This precludes the use of the brace-free statement form.
> Ooh.. Quick example: Why bother with a rather ghastly
>
> <table class='caution'>
> <thead>
> <tr>
> <th>Caution</th>
> </tr>
> </thead>
> <tbody>
> <tr>
> <td>Coffee is hot!</td>
> </tr>
> </tbody>
> </table>
>
> when a much more compact
>
> <table class='caution'>
> <thead><tr><th>Caution</th></tr></thead>
> <tbody><tr><td>Coffee is hot!</td></tr></tbody>
> </table>
>
> will do, *and* be more readable?
The problem with this is when you have a line that looks like this:
for (u16Index=0;u16Index<GLOBAL_u8NumDataPoints;u16Index++)
{DeviceManager_au8DeviceDetails[u16Index] = GLOBAL_u8DeviceInitialised;}
If you try to fit that all one line you end up with a 132 character line.
Al
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---