[sdiy] OT (but very synthy): C question

Neil Johnson neil.johnson97 at ntlworld.com
Mon Mar 28 22:53:20 CEST 2011


Hi,

Tim Daugard wrote:
> Use inclusion guards
> In one file (MIDI.h)
>  #ifndef MIDI_H
>   #define MIDI_H
>    #ifndef LFO_H
>    #inclde "LFO.h"
>    #endif
> ...
> #endif
>
> in the other file (LFO.h)
>  #ifndef LFO_H
>   #define LFO_H
>    #ifndef MIDI_H
>    #inclde "MIDI.h"
>    #endif
> ...
>  #endif
>
> Then it doesn't matter which is processed first

You don't need the inner inclusion guards, the outer per-file ones are
sufficient.

To Tom:
As others have said, don't use "this".  In the same vein don't use
"private" or "public" either.

Your approach is a typical implementation of OOP in C, not something
"by the backdoor" (heck, the first C++ compiler - CFront - compiled
C++ into C).

Perhaps a more valuable answer would go along the lines of "a good
intro book to C is ...." although its been so long since I trod that
path that I can't personally recommend any introductory books myself,
although I can recommend Harbison and Steele as a good read.

Neil
-- 
http://www.njohnson.co.uk



More information about the Synth-diy mailing list