[Gdal-dev] build error using Visual Studio 8

Mateusz Łoskot mateusz at loskot.net
Sun Apr 2 20:11:03 EDT 2006


Frank Warmerdam wrote:
> Mateusz Łoskot wrote:
>> Frank Warmerdam wrote:
>>> Mateusz Łoskot wrote:
>>>> The question is how GDAL should handle it. Should GDAL behave
>>>> more in C way or more in C++ way?
>>> Mateusz,
>>> 
>>> Well, for the specific case of function like strchr() that have
>>> "const correct" versions, I think this just helps us write better
>>> code.  We should just review any code with problems, and correct
>>> it to work properly with VS8.  In the case of the cpl_strtod.cpp
>>> change I took the path of least resistance with the cast because
>>> the code is complex and I'm afraid of trying to change too much.
>> 
>> I understand. I just would suggest to avoid using C version of
>> strchr in future.
> 
> Mateusz,
> 
> I don't see why there is a problem with using strchr()?  Just don't
> assume it will return a char * on a const char * argument and things
> will be ok.

Frank,
There is no problem with using strchr() but I'm saying that casting is a
bad idea. Simply, there should be no problem to desing solution in a way
to use const char*  or char* version of strchr(), but not mixing const
char*  with char*. I mean in C++.

p.s. I'm a little C++ puris ;-)

Cheers
-- 
Mateusz Łoskot
http://mateusz.loskot.net



More information about the Gdal-dev mailing list