Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #71342

Re: How to "fake" a member initialization?

From Paulo da Silva <p_s_d_a_s_i_l_v_a_ns@netcabo.pt>
Newsgroups comp.lang.c++
Subject Re: How to "fake" a member initialization?
Date 2020-01-14 15:33 +0000
Organization Aioe.org NNTP Server
Message-ID <qvkmvm$1g0c$1@gioia.aioe.org> (permalink)
References <qvieas$1dah$1@gioia.aioe.org> <ff24deb2-8021-4afd-9d5d-57b6021fd423@googlegroups.com>

Show all headers | View raw


Às 08:34 de 14/01/20, Frederick Gotham escreveu:
> On Monday, January 13, 2020 at 6:53:28 PM UTC, Paulo da Silva wrote:
>> Hi all!
>>
>> I have a member whose structure I don't know.
>> I don't need it to be initialized but the compiler warns me of that.
>> "Member 'foo' was not initialized in this constructor".
>>
>> Is there a way to tell the compiler that I don't want that member to be
>> initialized?
>>
>> Thanks
> 
> 
> You need to turn the warning off just for that one line.
> 
> You "push" the current compiler warning settings, you disable that one warning, you do your line of code, and then you "pop" all the warnings back the way they were.
> 
> Like this:
> 
> int main(void)
> {
>     int i;
> 
> #pragma GCC diagnostic push
> #pragma GCC diagnostic ignored "-Wuninitialized"           
>     int j = i + 5;
> #pragma GCC diagnostic pop
> 
>     return 0;
> }
> 
> If you want a portable way of doing this, look for "Hedley":
> 
> https://nemequ.github.io/hedley/user-guide.html
> 
This is worth seeing.

Thank you.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

How to "fake" a member initialization? Paulo da Silva <p_s_d_a_s_i_l_v_a_ns@netcabo.pt> - 2020-01-13 18:53 +0000
  Re: How to "fake" a member initialization? Öö Tiib <ootiib@hot.ee> - 2020-01-13 11:08 -0800
  Re: How to "fake" a member initialization? Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-13 20:12 +0100
  Re: How to "fake" a member initialization? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-01-13 20:15 +0000
  Re: How to "fake" a member initialization? Paulo da Silva <p_s_d_a_s_i_l_v_a_ns@netcabo.pt> - 2020-01-13 20:32 +0000
    Re: How to "fake" a member initialization? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-01-13 20:36 +0000
      Re: How to "fake" a member initialization? Paulo da Silva <p_s_d_a_s_i_l_v_a_ns@netcabo.pt> - 2020-01-13 20:59 +0000
        Re: How to "fake" a member initialization? Melzzzzz <Melzzzzz@zzzzz.com> - 2020-01-13 21:29 +0000
        Re: How to "fake" a member initialization? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-01-13 21:45 +0000
          Re: How to "fake" a member initialization? Paulo da Silva <p_s_d_a_s_i_l_v_a_ns@netcabo.pt> - 2020-01-14 01:04 +0000
    Re: How to "fake" a member initialization? Melzzzzz <Melzzzzz@zzzzz.com> - 2020-01-13 21:28 +0000
  Re: How to "fake" a member initialization? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2020-01-13 23:23 +0100
  Re: How to "fake" a member initialization? Frederick Gotham <cauldwell.thomas@gmail.com> - 2020-01-14 00:34 -0800
    Re: How to "fake" a member initialization? Paulo da Silva <p_s_d_a_s_i_l_v_a_ns@netcabo.pt> - 2020-01-14 15:33 +0000

csiph-web