MSVC Code Analysis warnings.

11 views
Skip to first unread message

pvr...@btinternet.com

unread,
Apr 5, 2025, 9:47:16 AM4/5/25
to fltk.general
I don't know if you are concerned, but I get the following warnings when I run Code Analysis tool in MSVC.

C:\Users\pvros\source\repos\fltk\FL\Fl_Help_View.H(85): warning C26495: Variable 'Fl_Help_Font_Style::c' is uninitialized. Always initialize a member variable (type.6).
C:\Users\pvros\source\repos\fltk\FL\Fl_Help_View.H(85): warning C26495: Variable 'Fl_Help_Font_Style::f' is uninitialized. Always initialize a member variable (type.6).
C:\Users\pvros\source\repos\fltk\FL\Fl_Help_View.H(85): warning C26495: Variable 'Fl_Help_Font_Style::s' is uninitialized. Always initialize a member variable (type.6).

The code concerned is:
/** Fl_Help_View font stack element definition. */
struct FL_EXPORT Fl_Help_Font_Style {
  Fl_Font      f;  ///< Font
  Fl_Fontsize  s;  ///< Font Size
  Fl_Color     c;  ///< Font Color
  void get(Fl_Font &afont, Fl_Fontsize &asize, Fl_Color &acolor) {afont=f; asize=s; acolor=c;} ///< Gets current font attributes
  void set(Fl_Font afont, Fl_Fontsize asize, Fl_Color acolor) {f=afont; s=asize; c=acolor;} ///< Sets current font attributes
  Fl_Help_Font_Style(Fl_Font afont, Fl_Fontsize asize, Fl_Color acolor) {set(afont, asize, acolor);}
  Fl_Help_Font_Style(){} // For in table use
};

I am using. FLTK version 1.4.0

Phil Rose

Greg Ercolano

unread,
Apr 5, 2025, 11:19:54 AM4/5/25
to fltkg...@googlegroups.com

On 4/5/25 6:47 AM, 'pvr...@btinternet.com' via fltk.general wrote:

I don't know if you are concerned, but I get the following warnings when I run Code Analysis tool in MSVC.

C:\Users\pvros\source\repos\fltk\FL\Fl_Help_View.H(85): warning C26495: Variable 'Fl_Help_Font_Style::c' is uninitialized. Always initialize a member variable (type.6).
C:\Users\pvros\source\repos\fltk\FL\Fl_Help_View.H(85): warning C26495: Variable 'Fl_Help_Font_Style::f' is uninitialized. Always initialize a member variable (type.6).
C:\Users\pvros\source\repos\fltk\FL\Fl_Help_View.H(85): warning C26495: Variable 'Fl_Help_Font_Style::s' is uninitialized. Always initialize a member variable (type.6).

    Seems like this would be the simple solution there.
    I'm not awake enough to commit.. Devs?



   Fl_Help_Font_Style(Fl_Font afont, Fl_Fontsize asize, Fl_Color acolor) {set(afont, asize, acolor);}
-  Fl_Help_Font_Style() {} // For in table use
+  Fl_Help_Font_Style() {set(FL_HELVETICA, FL_NORMAL_SIZE, FL_BLACK);} // For in table use
  };



Reply all
Reply to author
Forward
0 new messages