Re: [PIC] Learning C
K S <[email protected]>
| Newsgroups | gmane.comp.hardware.microcontrollers.pic |
|---|---|
| Message-ID | <CAFEth_y6ABtutOCt1xQSnN0Lr8f-B3Z_nr6CWEygxqLKX=kbxg@mail.gmail.com> |
> > That is truly the one downside in C... some coders' styles can render > code quite illegible. > After 20+ years of assembly, when I first started with C I was daunted by many example listings even though the fundamental C syntax seemed simple. But I got my foot in with K&R and then a tonne of online resources helped further over the years. In hindsight those daunting listings most often had higher levels of sophistication exploiting pointers and data structures to aid in scalability, portability, abstraction, encapsulation, etc. The cost/benefits of this is akin to using interrupts rather than simple blocking routines - it's often a lot less immediately intuitive to have ISRs rather than a single monolithic block of polling code, but it allows so much more. These things can cause a C noob's eyes to glaze over but are usually (hopefully!) much more than just obfuscation or showing off. These days my code looks remarkably different from what it did in my first few years of C (even though that old code was still fully functional) and I'm sure to someone less familiar they'd think it's over the top. But it's done for good reason. Certainly with constrained resources like on an 8bit PIC some of these things make less sense and "quick and easy and nasty" is appropriate. K&R and the basics is IMO still a great place to start. >