[bitc-dev] Conditional compilation

Jonathan S. Shapiro shap at eros-os.com
Thu Jul 17 15:57:17 CDT 2008


On Thu, 2008-07-17 at 20:54 +0000, Eric Rannaud wrote:
> Oh, and there is another case I forget, for which you would need
> language support:
> 
> struct a {
> 	int x, y;
> #ifdef DEPRECATED_FEATURE /* too go in 2 revisions */
> 	char c;
> #endif
> };

This is definitely not something that should be done with the
preprocessor. In this particular case, what you are looking for is an
annotation.

> Of course, I guess one can do that with type classes. But is it worth
> the trouble? And there is no 'deriving' (cf. Haskell) in BitC, is
> there? 

Not yet, but that is about to be fixed.

> I can't think of a way of doing in BitC, without conditional
> compilation, the equivalent of
> 
> void foo(struct a *a, int p)
> {
> 	a->x = p;
> 	a->y = 2*p;
> #ifdef DEPRECATED_FEATURE
> 	a->c = '0';
> #endif
> }

Or equivalently, some form of clean-ish macro mechanism.



More information about the bitc-dev mailing list