[Gambas-devel] conditional compilation

Benoit Minisini gambas at ...1...
Fri Oct 6 20:51:57 CEST 2006


On Friday 06 October 2006 15:30, chintan rao wrote:
> >> Hi,
> >>
> >> >From: Benoit Minisini <gambas at ...1...>
> >> >To: mailing list for gambas developers <
> >> > gambas-devel at lists.sourceforge.net
> >> >
> >> >
> >> >I never really think about this feature. I think the a preprocessor
> >>
> >> should
> >>
> >> >be included inside the compiler, just after or during the tokenization
>
> of
>
> >> the
> >>
> >> >source code.
> >> >Note that at the moment, I found no need for a preprocessor in Gambas.
> >>
> >> Maybe
> >>
> >> >this should be asked first on the mailing-list.
> >>
> >> I have not coded much in gambas. This could be one possibility.
> >> You could possibly have .
> >>
> >> #IF <classname>
> >> code for classname
> >> #ELSE
> >> "error"
> >> #ENDIF
> >>
> >> or we could have
> >> #IFNDEF <classname>
> >> "error"
> >> #ENDIF
> >>
> >> This way you could even avoid #define statements.
> >> Does this make it bit like c++/c ?I don't think so.
> >> I think it is simple enough to understand for a Gambas user.
> >> What do you think about this?
> >>
> >> yours sincerely
> >> Chintan Rao H
> >
> >What does '#IF <classname>' means exactly?
> >
> >--
> >Benoit Minisini
>
> #IF <classname>
> It means that if there exists by that name (classname) the code will be
> compiled for that class.
> I dont know weather this feature will be usefull.

The compiler can't know which classes "exist", as they are discovered when the 
interpreter loads classes.

The compiler just knows that some identifiers are classes with the components 
needed by the project (he looks inside *.list files), and with the classes 
defined in the project.

So I don't really see the need of this. Give me a concrete example, maybe I 
will understand what you are in mind.

Regards,

-- 
Benoit Minisini





More information about the Devel mailing list