In Ivanhoe, file "low_depth.c", there is "#include "low_depth.c"". The file recursively includes itself. Why?
Is this just sloppy programming?
And, other Ivanhoe files do this.
recursive inclusion
- Bo Persson
- Posts: 14
- Joined: Thu Jun 10, 2010 10:34 am
- Real Name: Bo Persson
- Location: Malmö, Sweden
Re: recursive inclusion
I think they just outsmarted themselves.benstoker wrote:In Ivanhoe, file "low_depth.c", there is "#include "low_depth.c"". The file recursively includes itself. Why?
Is this just sloppy programming?
And, other Ivanhoe files do this.
There is an include guard that makes the second inclusion different from the first, so the code is compiled once for white and once for black. Doing that in a single file is just too cute, if done on purpose, or just silly if they didn't some up with the idea of having two .c files (low_depth_black and low_depth_white) that include a common set of .h files.