[gl2ps] index conflicts with <string.h> header file

Christophe Geuzaine cgeuzaine at ulg.ac.be
Mon Sep 3 07:47:33 CEST 2012


Hi Daniel - Thanks for the patch; I've applied it in SVN

On 03 Sep 2012, at 02:00, Daniel J Sebald <daniel.sebald at ieee.org> wrote:

> Just a followup on this post:
> 
>> In gl2ps.c are a few instances of a variable called "index".  There is a
>> global name "index" via <string.h> header that creates a
>> shadow-global-name warning when compiled.  A simple fix is to change the
>> name of the variable in a half dozen places.
> 
> Perhaps I wasn't clear on where the shadow warnings come from.  Try the following compilation command in the gl2ps source tree:
> 
> gcc -c -Wshadow gl2ps.c
> 
> Because <string.h> is included in gl2ps.c, there is a conflict between the global library function "index" and the variable "index".  It's inconsequential because gl2ps is not using the "index" function. Ridding the warnings would be nice.  I've attached a patch that replaces the variable "index" with "idx".  Try
> 
> patch < gl2ps_replaceindexwithidx_2012sep02.patch
> gcc -c -Wshadow gl2ps.c
> 
> Thanks,
> 
> Dan
> <gl2ps_replaceindexwithidx_2012sep02.patch>_______________________________________________
> gl2ps mailing list
> gl2ps at geuz.org
> http://www.geuz.org/mailman/listinfo/gl2ps

-- 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine