[-Wreorder] Warning

MEKA

Discord: mekaprojects
Site yetkilisi
Süper Moderatör
Premium Üye
Grafiker
Geliştirici
Yardımsever Üye
Mesaj
2.790
Çözümler
287
Beğeni
2.044
Puan
1.850
Ticaret Puanı
2
Bu warningi alma nedenimiz kod sıralamasından kaynaklanıyor

Bash:
char.cpp: In constructor 'switch_channel_info::switch_channel_info()':
char.cpp:7989:6: warning: 'switch_channel_info::secs' will be initialized after [-Wreorder]
 7989 |  int secs;
      |      ^~~~
char.cpp:7988:22: warning:   'DynamicCharacterPtr switch_channel_info::ch' [-Wreorder]
 7988 |  DynamicCharacterPtr ch;
      |                      ^~
char.cpp:7993:2: warning:   when initialized here [-Wreorder]
 7993 |  switch_channel_info()
      |  ^~~~~~~~~~~~~~~~~~~

Warning Verilen Hali:
EVENTINFO(switch_channel_info)
{
    DynamicCharacterPtr ch;
    int secs;
    long newAddr;
    WORD newPort;

    switch_channel_info()
        : secs(0),
        ch(),
        newAddr(0),
        newPort(0)
    {
    }
};

Düzenlenmiş Hali:
EVENTINFO(switch_channel_info)
{
    DynamicCharacterPtr ch;
    int secs;
    long newAddr;
    WORD newPort;

    switch_channel_info(): ch(),
        secs(0),
        newAddr(0),
        newPort(0)
    {
    }
};
 
Geri
Üst