[GRASS5] C and C++ compiler changes?

Laura Toma ltoma at bowdoin.edu
Sun Oct 26 21:08:11 EST 2003


On Wednesday, October 22, 2003, at 09:07 PM, Glynn Clements wrote:

>
> Laura Toma wrote:
>
>> Yes, only for C++. It certainly is a pain to maintain C++ with the new
>> gcc 3.x, but there's no way around it..It's  the price to pay for
>> efficient code.
>>
>> The main reason r.terraflow is in C++ instead of C is templating.
>
> In that case, some portability issues are probably inevitable.
> Templates were one of the last things to be standardised, and one of
> the last things to be fixed in gcc.
>

yes..should not be a problem on any platform for which gcc is 
supported. but won't work with other compilers.

>> All
>> functions are templated and the type is determined at runtime,
>
> Er, compile time, right? Or is it using virtual methods?
>

yes, i meant compile time. no virtual methods (they're slow).


>> causing
>> the appropriate function to be instantiated. This is more efficient 
>> than
>> using void* in C, and also saves *a lot* of redundant code.
>
> Is this just for ELEV_SHORT vs ELEV_FLOAT, or is it more extensive
> than that?
>

essentially that's it, plus all the type that include these two.  
practically everything is templated.


> -- 
> Glynn Clements <glynn.clements at virgin.net>
>

-Laura




More information about the grass-dev mailing list