[PATCH 5/5] Limit the scope of gasidx in add_plan_to_notes

Jef Driesen jef at libdivecomputer.org
Thu Jul 10 23:48:38 PDT 2014


On 2014-07-10 22:36, Dirk Hohndel wrote:
> On Thu, Jul 10, 2014 at 10:34:24PM +0200, Anton Lundin wrote:
>> On 10 July, 2014 - Dirk Hohndel wrote:
>>> IIRC we don't want to use this in C files because some older C 
>>> compilers
>>> throw up with it...
>>> 
>> 
>> I checked, and we already do, for windows atleast =)
>> 
>> windows.c:		for (int i = 0; i < len; i++)
> 
> He. And here I thought it was MSVC that had problems with it...
> Since clang on Apple and both gcc and clang on Linux are fine, I guess
> I'll take the patch :-)

I don't know about the latests versions of msvc, but msvc doesn't 
support most C99 features. However, in C++ mode many of them are 
supported. And that's exactly the trick I use for libdivecomputer: build 
the C code with C++ compiler. There are just a few things you have to be 
aware of that are supported in C but not C++ (for example casting from 
void pointer to another pointer type requires an explicit cast).

Actually, I always use mingw as cross compiler from linux, but I do make 
sure the code can be compiled with msvc, for those Windows developers 
that prefer msvc :-)

Jef


More information about the subsurface mailing list