1

私はコードを読んでいます。これはC ++にあると思います:

 union Float_t
 {
    Float_t(float num = 0.0f) : f(num) {}
    // Portable extraction of components.
    bool Negative() const { return (i >> 31) != 0; }
    int32_t RawMantissa() const { return i & ((1 << 23) - 1); }
    int32_t RawExponent() const { return (i >> 23) & 0xFF; }

    int32_t i;
    float f;
    #ifdef _DEBUG
    struct
    {   // Bitfields for exploration. Do not use in production code.
         uint32_t mantissa : 23;
         uint32_t exponent : 8;
         uint32_t sign : 1;
    } parts;
    #endif
};

誰かが2つのことを説明できますか?

1..

 Float_t(float num = 0.0f) : f(num) {}   

この行は何を言っているのですか?f が定義されていない場合、f(num) はどういう意味ですか?

2. コードの後半で #ifdef _DEBUG と #endif が必要なのはなぜですか?

ありがとう。

4

1 に答える 1