Menu

Considering a switch from BloodshedDevC++, how's the math?

2014-07-07
2014-10-04
  • PizzaCoffee

    PizzaCoffee - 2014-07-07

    How many bytes in the long double with TDM-GCC x64 4.8.1?
    How many will I get to use under 32 bit XP?
    Are there any specs to be found on this compiler?

     
  • FurryGuy

    FurryGuy - 2014-07-10

    A 32-bit long double is 12 bytes, a 64-bit long double is 16 bytes. A 32-bit nullptr is 4 bytes, a 64-bit nullptr is 8 bytes. Those are the only two fundamental data types that appear to have differing bytes sizes depending on 32/64-bit compilation.

     
  • FurryGuy

    FurryGuy - 2014-10-04

    Type the following code into a new C++ project and compile it either as 32-bit or 64-bit. When you run the program you will see the byte sizes for the fundamental data types in C++.


    #include <iostream>
    #include <conio.h>
    
    using std::cout;
    
    int main()
    {
        cout << "The fundamental data types in C++:\n\n";
    
        cout << "Integer types:\n";
        cout << "The size of a char is:\t\t" << sizeof(char) << " byte(s).\n";
        cout << "The size of a wchar_t is:\t" << sizeof(wchar_t) << " byte(s).\n";
        cout << "The size of a short int is:\t" << sizeof(short) << " byte(s).\n";
        cout << "The size of an int is:\t\t" << sizeof(int) << " byte(s).\n";
        cout << "The size of a long int is:\t" << sizeof(long) << " byte(s).\n";
        cout << "The size of a long long int is:\t" << sizeof(long long) << " byte(s).\n\n";
    
        cout << "Floating point types:\n";
        cout << "The size of a float is:\t\t" << sizeof(float) << " byte(s).\n";
        cout << "The size of a double is:\t" << sizeof(double) << " byte(s).\n";
        cout << "The size of a long double is:\t" << sizeof(long double) << " byte(s).\n\n";
    
        cout << "Character types:\n";
        cout << "The size of a char is:\t\t" << sizeof(char) << " byte(s).\n";
        cout << "The size of a wchar_t is:\t" << sizeof(wchar_t) << " byte(s).\n";
        cout << "The size of a char16_t is:\t" << sizeof(char16_t) << " byte(s).\n";
        cout << "The size of a char32_t is:\t" << sizeof(char32_t) << " byte(s).\n\n";
    
        cout << "Boolean type:\n";
        cout << "The size of a bool is:\t\t" << sizeof(bool) << " byte(s).\n\n";
    
        cout << "Null pointer type:\n";
        cout << "The size of a nullptr is:\t" << sizeof(nullptr) << " byte(s).";
    
        _getch();
        return 0;
    }
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.