RE: use unsigned iterator i in generated source

"Gyozo, PAPP (VBuster)" <[email protected]>
Newsgroups gmane.comp.gnu.gengetopt.general
Message-ID <[email protected]>

> -----Original Message-----
> From: Lorenzo Bettini [mailto:[email protected]]
> Sent: Tuesday, June 27, 2006 5:38 PM
> To: Users list for gengetopt
> Subject: Re: [help-gengetopt] use unsigned iterator i in generated
> source
> 
> 
> Gyozo, PAPP (VBuster) wrote:
> > Hi,
> > 
> >> -----Original Message-----
> >> From: Lorenzo Bettini [mailto:[email protected]]
> >> Sent: Saturday, June 03, 2006 4:11 PM
> >> Gyozo, PAPP (VBuster) wrote:
> >>> Hi,
> >>>
> >>> I running the latest 2.17rc. This version generates the 
> >> getoptions_file_save() functions with a signed int i which 
> >> results a lots of signed/unsigned warning. Please modify the 
> >> corresponding .h_skel to use unsigned int.
> >> Hi
> >>
> >> I checked this matter, and the code is
> >>
> >> for (i = 0; i < args_info->@opt_var@_given; ++i)
> >>
> >> which should not generate warnings, since the _given field 
> is an int, 
> >> and not an unsigned.  I myself always compile the tests with 
> >> -Wall so I 
> >> should have received the warning too, which didn't happen...  what 
> >> warning do you get (in particular, which line of code 
> generates the 
> >> warning)?
> > 
> > Sorry for the inconvenience, this was my fault. I patched 
> my gengetopt and forgot it.
> > 
> 
> so the warning doesn't show up?

No, with the original tarball. This was the root of evil:

@@ -143,7 +141,7 @@
 @parser_name@_file_save(const char *filename, struct @args_info@ *args_info)
 {
   FILE *outfile;
-  int i = 0;
+  unsigned int i = 0;
 
   outfile = fopen(filename, "w");
 
Quite obvious. Once again, sorry to blame.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.