Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Why idempotent?

Author: Heiner Marxen

Date: 09:50:46 02/15/00

Go up one level in this thread


On February 14, 2000 at 18:43:16, Daniel Clausen wrote:

>Hi
>
>>>#include "search.c"
>>>#include "board.c"
>>>#include "data.c"
>>>#include "eval.c"
>>>#include "main.c"
>
>>This may, for reasons that are beyond me (no CS background btw), make
>>wintel-centric compilers improve the code generated, but it is _not_ portable,
>>and unless I am wrong, it is _not_ standard C.
>>
>>If someone could clarify this, I would appreciate it.  If by chance I am wrong,
>>my appologies Dan.  But it won't compile like this in Codewarror.
>
>As far as I know, the C-language definition doesn't *forbid* to include c-files
>directly. The reasons why it didn't compile is prolly one of the following:
>
>1 In your project you should only add the one file containing Dan's funny
>  includes. Don't add the other files to the project or you'll end up with
>  "duplicate definitions" etc. Just make sure that you'll add the path for
>  the rest of the .c files to your project.
>
>2 If you did that it will prolly fail because there are no #ifndef's in
>  Tom's header files. Therefore you'll most prolly will end up with msgs
>  saying "identifier <whatever> redeclared" and stuff like that.
>
>  To prevent this you can add the following stuff in the header files.
>
>  #ifndef __MYHEADERFILE_H__
>  #define __MYHEADERFILE_H__
>
>  <rest of header file>
>
>  #endif /* __MYHEADERFILE_H__ */
>
>  If the same headerfile will be included more than once the #ifndef will
>  cause the compiler (or more the preprocessor) to 'ignore' it the 2nd time.
>
>  Note that a lot of people often use _MYHEADERFILE_H_ instead. (only one
>  leading/trailing underscore) While this may work fine in most cases, it's
>  not nice, since symbols starting with 1 underscore belong to the compilers
>  namespace.

7.1.3 Reserved identifiers

All identifiers that begin with an underscore and either an uppercase
letter or another underscore are always reserved for any use.

Heiner

>Kind regards,
> -sargon



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.