Hi,
It's always a good idea, initialize vars like horiz_alignment and 
horiz_alignment, with default value.
Because, function like iFlatTabsGetAlignment can fail in set value and these 
vars can be trash when
function returns.

That's the reason what compiler emits this warning.

Best.

Ranier
________________________________________
De: Antonio Scuri <[email protected]>
Enviado: domingo, 10 de dezembro de 2017 17:47
Para: IUP discussion list.
Assunto: Re: [Iup-users]        Silence gcc warning: ‘vert_alignment’ may be 
used uninitialized in this function

  Those variables are initialized 20 lines bellow in:

  iFlatTabsGetAlignment(alignment, &horiz_alignment, &vert_alignment);

  And they are not used before that. But iFlatTabsGetAlignment should 
initialize even in "alignment" is NULL. That was missing. Actually I did a full 
check on ALIGMENT attributes on all controls that use horizontalxvertical 
alignment options and found some minor errors too. Fixed and committed to SVN.

Best,
Scuri


2017-12-10 11:23 GMT-02:00 Ranier VF 
<[email protected]<mailto:[email protected]>>:
Hi,
initialize vars to silence gcc warning

--- iup/iup/src/iup_flattabs.c  2017-09-04 18:44:26.000000000 -0300
+++ iup_dev/iup/src/iup_flattabs.c      2017-12-10 11:19:01.570274940 -0200
@@ -443,7 +443,7 @@
   int title_height = iFlatTabsGetTitleHeight(ih, &title_width, 1);
   int fixedwidth = iupAttribGetInt(ih, "FIXEDWIDTH");
   Ihandle* child;
-  int pos, horiz_alignment, vert_alignment, tab_x = 0;
+  int pos, horiz_alignment = 0, vert_alignment = 0, tab_x = 0;
   unsigned char line_r = 0, line_g = 0, line_b = 0;
   int show_close = iupAttribGetBoolean(ih, "SHOWCLOSE");
   int tab_highlighted = iupAttribGetInt(ih, "_IUPFTABS_HIGHLIGHTED");

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Iup-users mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/iup-users


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to