[ros-dev] [ros-diffs] [hbelusca] 58902: [FREELDR] - Fix some function parameter types, so to avoid unuseful casts (from pointers to const strings to pointers to strings in particular). - The big thing: make FreeLdr load...
Timo Kreuzer
timo.kreuzer at web.de
Wed May 1 22:30:10 UTC 2013
I have an actual pragmatic argument against one liners:
When you debug code (and I mean with a real debugger aka WinDbg and not
kdbg) and you step through the source, whenever there is a one liner,
you just don't see which branch it takes and whether it executed the
statement or not. So you have to check other things. Look at the
variables. And when there is stuff like
"if (FOO_MACRO(Value)) GlobalVariable++;" you are simply f***ed.
You'll have to add a watch for GlobalVariable and check the value before
and after.
I really prefer to see what path the code takes, when stepping over it.
So it's not a question of style or beauty, but a question of convenient
debugging.
I know it does not apply to all kinds of one liners, but I also don't
think that one liners make the code any more readable.
Just my 2 cents.
Am 01.05.2013 22:51, schrieb Aleksey Bragin:
> I'm fine with oneliner if statemens, like
> if (!NT_SUCESS(Status)) return Status;
>
> as they actual make sense.
>
> However, in this case with a while example, it's far from being
> readable. Also, why use preincrement instead of a postincrement, when
> the resulting value is not used?
>
> Regards,
> Aleksey Bragin
>
> On 01.05.2013 22:31, Timo Kreuzer wrote:
>>
>> I'm not a fan of single line conditional statements.
>> I'd prefer if we had a style rule for that.
>> Any thoughts on that?
>>
>>
>> Am 01.05.2013 19:12, schrieb hbelusca at svn.reactos.org:
>>> Author: hbelusca
>>> Date: Wed May 1 17:12:56 2013
>>> New Revision: 58902
>>
>>> do
>>> {
>>> - while (*LoadOptions == '/')
>>> - ++LoadOptions;
>>> -
>>> + while (*LoadOptions == '/') ++LoadOptions;
>>> *NewLoadOptions++ = *LoadOptions;
>>> } while (*LoadOptions++);
>>>
>>
>
>
> _______________________________________________
> Ros-dev mailing list
> Ros-dev at reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev
>
More information about the Ros-dev
mailing list