0

Specifically, what is _CH_? I'm pretty sure it is related to some sort of #include safety.

This is the form of the code I found in a header file:

#ifndef FOOBAR_H
#define FOOBAR_H

// Function prototypes

#ifdef _CH_
#pragma importf "foobar.c"
#endif
#endif
Michael Petch
  • 46,082
  • 8
  • 107
  • 198
AndrewH
  • 3,418
  • 2
  • 15
  • 27

1 Answers1

2

CH is a C/C++ interpreter. Information about it can be found here and is described as:

"Ch is the most complete, cross-platform C interpreter and scripting engine in existence.".

It appears that the check for _CH_ is to determine if a C file is being processed under CH. In this case if it was being processed by CH then it would process the line #pragma importf "foobar.c".

From what I can tell from the CH documentation the #pragma importf imports another file:

search module1.c in current directory first, then directories specified in _fpath

In our case it would search for "foobar.c" and import it.

In environments other than CH, _CH_ wouldn't be defined and the statements in the #ifdef _CH_ block are ignored.

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
  • Thanks! This was code from a professor, why am I not surprised that it would be in relation to some proprietary software? – AndrewH Oct 30 '14 at 18:26
  • The only other time I have ever seen reference to CH was with regards to Lego Mindstorm robotics. It seems to have a niche market including academia. – Michael Petch Oct 30 '14 at 18:30