Re: [PIC] Learning C

Allen Mulvey <[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.pic
Message-ID <[email protected]>
Yes, I think today, for some, it is a kind of "snob appeal" to use 
obscure code but decades ago code optimization was mostly done by the 
coder not the compiler. I think that is where some of it may have 
originated. Today the compiler can optimize much better than I can and 
most decent editor have auto-format. This not only makes the code more 
readable but far easier to debug. I frequently use "unnecessary" local 
variables knowing that the compiler will take them away. It makes the 
code much easier to follow if I need to come back to update the section. 
I actually discovered this by accident a long time ago. After making 
some obscure code much more readable the compiled size was unchanged. 
Personally, I think using obscure code is foolish.

Allen Mulvey

On 11/14/2024 8:57 AM, Clint Jay wrote:
>    David C Brown,<[email protected]>  wrote
>
>> Onew of the problems I have with trying to understand code examples in C
> is
>> that so many of them are incomprehensibly dense.
>>
> There is a faction among programmers who seem to enjoy swinging their
> appendages by writing the most impenetrable, dense code to somehow show off
> their "prowess" and sneer at anyone who can't decode their drivel.
>
> Tabs, spaces, empty lines cost nothing and it makes me think a lot less of
> the people who create code intended to make other people's lives harder.
>
>
> On Thu, 14 Nov 2024 at 12:35, RussellMc<[email protected]>  wrote:
>
>>   David C Brown,<[email protected]>  wrote
>>
>>> Onew of the problems I have with trying to understand code examples in C
>> is
>>> that so many of them are incomprehensibly dense.
>>>
>> When writing C++ code I formatted in a way which to me makes it far more
>>> readable than the normal manner of presentation.
>>
>> I place  { on the line following and then indent code following an Indian
>> it again for any other functions such as if / while / case ... .
>> The end result is code who's structure leaps out and grabs you. I started
>> off being somewhat surprised that this wasn't standard practice come to
>> accept that most people prefer density and obfuscation.
>> Apart from taking more space I can see no disadvantages and this approach
>> and for me the gains are substantial.
>>
>> I spent many decades working mainly in assembler and
>>   actually find it generally easier to see what's going on than in most
>> higher level languages.
>>
>>
>> Russell.
>> --
>> http://www.piclist.com/techref/piclist  PIC/SX FAQ & list archive
>> View/change your membership options at
>> https://mailman.mit.edu/mailman/listinfo/piclist
>>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.