[ale] [OT] Two weeks in, the difficulties mount

Michael Potter michael at potter.name
Sun Dec 13 22:10:05 EST 2015


Leam,

Very nice code structure.  You are obviously a disciplined programmer.

Here are two quick comments about your code:

1) use {} on your if even if there is only one line of code.  Two reasons:
   a) it is too easy to add a line of code and break the if later (and
sometimes it will not cause a compile error).
   b) if you do add the line of code and also add the {} later, then when
you look at the code change using git diff, you see the add for the {} in
addition to your logic change.  it is alway nice to only see the logic
change in git diff, not code structure change.

2) your modules only return a pointer to "struct driver" or accept it as a
parameter. You can use a technique called opaque structures. You can google
opaque structure to find a technique that works for you, but it in a
nutshell, it is used to hide the elements of the structure for the calling
routines and only allow the module.c code to change the elements.

There are several techniques, here is the technique I use:
1) replace "struct driver {...}:" in module.h with "struct driver *;"
2) move "struct drive {...};" to module.c



On Fri, Dec 11, 2015 at 8:56 PM, Christopher Hagler <
haglerchristopher at gmail.com> wrote:

> I would definitely be interested in joining. I have not done any major
> programming in C and assembly langauge since college, but I am confident I
> will be able to pick it back up after a short review. I just joined the
> mailing list, so I missed all of the details and the previous
> conversations. However, if there is anything that I need to know, you can
> just send me a direct email. Also, I have been toying around with C in my
> spare time. I am currently implementing a compiler and a home automation
> framework that is all written in C. If you would like to work on these
> projects, you are more than welcome too.
>
> 1) https://github.com/haglerchristopher/automation/tree/development
> 2) https://github.com/haglerchristopher/compiler/tree/development
>
> This sounds like it is going to be a lot of fun, and I look forward to
> working with you.
>
> On Fri, Dec 11, 2015 at 7:03 PM, Leam Hall <leamhall at gmail.com> wrote:
>
>> I've been doing the "Learn C the Hard Way" thing for a little over two
>> weeks now. For those of you wondering why we should do it as a group;
>> consider the ease of distraction. Work is stressful, should I learn
>> something that can go straight to my resume faster? Is there something more
>> fun I could learn? Am I spending enough time with the family? Will I ever
>> get anywhere anyway? Am I going too slow? Too fast?
>>
>> Learning with others encouraging you can really help. I'm also trying to
>> learn Spanish, our weekly visits to the local Mexican restaurant really
>> help bring the language to life.
>>
>> With C it's a little harder to "go talk to someone". I did do a few lines
>> just to test a thought the other day. Normally that would take me a lot
>> more time. Okay, half a dozen lines of "if {...}..." won't change the
>> world. I'm hoping it will change me.
>>
>> For those of you who have volunteered to mentor, my deepest thanks! I
>> expect we'll get in over our heads shortly. For those thinking about
>> joining, or secretly checking for the book on Amazon, jump on in! We
>> officially start 1 Jan. By 1 Apr you'll be 3 months older. Will you know
>> more C 1 Apr than you did 1 Jan?
>>
>> Leam
>>
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
>>
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
>


-- 
Michael Potter
  Tapp Solutions, LLC
   www.tappsolutions.com
+1 770 815 6142  ** Atlanta ** michael at potter.name  **
www.linkedin.com/in/michaelpotter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20151213/0bbf56df/attachment.html>


More information about the Ale mailing list