Code::Blocks Forums
User forums => General (but related to Code::Blocks) => Topic started by: 2Eric on September 08, 2024, 01:22:16 am
-
The book says 10 bytes the program below says 8 bytes
#include <iostream>
using namespace std;
int main()
{
cout << "The size of bool is:\t" << sizeof(bool) << " bytes.\n"; //1
cout << "The size of char is:\t" << sizeof(char) << " bytes.\n"; //1
cout << "The size of short is:\t" << sizeof(short) << " bytes.\n"; //2
cout << "The size of int is:\t" << sizeof(int) << " bytes.\n"; //4
cout << "The size of float is:\t" << sizeof(float) << " bytes.\n"; //4
cout << "The size of long is:\t" << sizeof(long) << " bytes.\n"; //4
cout << "The size of double is:\t" << sizeof(double) << " bytes.\n"; //8
cout << "\n";
cout << "The size of unsigned short int is:\t" << sizeof(unsigned short int) << " bytes.\n"; //2
cout << "The size of unsigned long int is:\t" << sizeof(unsigned long int) << " bytes.\n"; //2
cout << "The size of long int is:\t\t" << sizeof(long int) << " bytes.\n"; //4
cout << "The size of wchar_t is:\t\t\t" << sizeof(wchar_t) << " bytes.\n"; //2
cout << "The size of unsigned int is:\t\t" << sizeof(unsigned int) << " bytes.\n"; //4
cout << "The size of long double is:\t\t" << sizeof(long double) << " bytes.\n"; //8
return 0;
}
-
Perhaps the 10 bytes is related to the fact that functions like printf() and scanf() use the default Microsoft Visual C++ Runtime (MSVCR) library functions, which allow only 64-bit floating points, while MinGW uses its own 80-bit implementation.
Keep in mind that results depend on the platform. CodeBlocks/GCC on 32-bit Windows computers shows 12 bytes as the result, and 64-bit Windows shows 16 bytes for long double. See attached screenshot and https://stackoverflow.com/questions/4089174/printf-and-long-double (https://stackoverflow.com/questions/4089174/printf-and-long-double). I hope this helps
-
This is OT here, please use C++ forums for this kind of questions.
-
Link to help you know what is On Topic instead of Off Topic (OT) https://forums.codeblocks.org/index.php/topic,9996.0.html (https://forums.codeblocks.org/index.php/topic,9996.0.html)
Link to FAQs https://wiki.codeblocks.org/index.php/FAQ (https://wiki.codeblocks.org/index.php/FAQ)
Tim S.
-
This is OT here, please use C++ forums for this kind of questions.
I do not believe this, WHERE has someone said I tried the program you listed on my computer and it works good. with 10 bytes ,
-
This is OT here, please use C++ forums for this kind of questions.
I do not believe this, WHERE has someone said I tried the program you listed on my computer and it works good. with 10 bytes ,
Maybe about 24 hours ago ago I spend a few minutes looking for a link to donate money to the project, I could not find it, maybe I should ask my bank where the link is.
I went to bed last thinking I am getting some value out of Code::Block, I was really looking forward to making a donation. BUT the replied I am getting now, I am going to wipe Code::Blocks off the system and try out come other C++ program, and if I get banned from this group that will be one sure way that some other C++ project gets some donation from me.
-
This is OT here, please use C++ forums for this kind of questions.
I do not believe this, WHERE has someone said I tried the program you listed on my computer and it works good. with 10 bytes ,
Maybe about 24 hours ago ago I spend a few minutes looking for a link to donate money to the project, I could not find it, maybe I should ask my bank where the link is.
I went to bed last thinking I am getting some value out of Code::Block, I was really looking forward to making a donation. BUT the replied I am getting now, I am going to wipe Code::Blocks off the system and try out come other C++ program, and if I get banned from this group that will be one sure way that some other C++ project gets some donation from me.
Suggest looking up the term "Help Vampire" because I think you will likely be labeled one in the future.
Read this website rules and the FAQs I posted if you wish to continue on this website!
Tim S.
-
@2Eric seems like you do not know what the difference between an IDE and a compiler is. I would suggest you have a read on what an IDE is and what a compiler is to find out the difference.
You are complaining about the compiler you are using, but blaming the IDE that has NOTHING to to with your problem.
The issue you raise should be closed as it has nothing to do with Codeblocks IDE.