Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,757 members, 7,813,509 topics. Date: Tuesday, 30 April 2024 at 01:11 PM

What Exactly Do Modifier Types In C++ Do? More Emphasis On Integer Modifiers - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / What Exactly Do Modifier Types In C++ Do? More Emphasis On Integer Modifiers (626 Views)

How To Apply Algebraic Boolean Modifier In Blender / Reverse Python Integer Using Reverse_int / Integer Types Should Inherit From ... (2) (3) (4)

(1) (Reply) (Go Down)

What Exactly Do Modifier Types In C++ Do? More Emphasis On Integer Modifiers by TastyFriedPussy: 9:35am On Oct 30, 2022
Please experienced C++ devs should help me explain this in detail.

Do interger modifiers just increase the amount of space assigned to an interger in memory?

Because the size of int's is usually 2 abi 4 bytes

But for instance, I declare an int with the long long prefix and then ask for the size using sizeof(), the size dramatically shoots to 8bytes for only God knows why. That's why I'm asking, do integer modifiers just Increase size in memory or is there something else they do?
Re: What Exactly Do Modifier Types In C++ Do? More Emphasis On Integer Modifiers by TastyFriedPussy: 9:44am On Oct 30, 2022
Don't just read and pass nauuuu cry
Re: What Exactly Do Modifier Types In C++ Do? More Emphasis On Integer Modifiers by Luckydonalds(m): 11:56am On Oct 30, 2022
I'm no C++ expert but from my knowledge of C, I can answer your question.

The int data type is a signed integer data type, it's memory size is 32bits in modern architecture. It could be less than that in older computers. This means that int can store integers varying from -2³¹ to 2³¹ - 1 where the most significant bit is the sign bit. But this only allows computers to be able to make calculations within this range, -2 billion to 2 billion (which is 10 digits) and is very limiting. Eg, you cannot store your ATM 16 digit number using this data type. If you store such number in an int, you get an integer overflow and you won't get the expected result.

Enter the long data type, this is a 64bit signed integer data type. It stores integers from -2⁶³ to 2⁶³ - 1. It can store numbers within this range (-9*10¹⁸ to 9*10¹⁸) which is very convenient for our use today.

All these are heavily dependent on the architecture you're building with and your OS.
It's considered good practice to use,

int8_t # exactly 8 bits
int16_t # exactly 16 bits
int32_t # exactly 32 bits
iint64_t # exactly 64 bits

size_t

2 Likes

Re: What Exactly Do Modifier Types In C++ Do? More Emphasis On Integer Modifiers by qtguru(m): 2:36pm On Oct 30, 2022
TastyFriedPussy:
Please experienced C++ devs should help me explain this in detail.

Do interger modifiers just increase the amount of space assigned to an interger in memory?

Because the size of int's is usually 2 abi 4 bytes

But for instance, I declare an int with the long long prefix and then ask for the size using sizeof(), the size dramatically shoots to 8bytes for only God knows why. That's why I'm asking, do integer modifiers just Increase size in memory or is there something else they do?

They contain an amount of memory, remember every code you write takes up memory, during the fetch-execute cycle. memory has to be allocated.

If you deal with Characters and Keyboard mappings, they are guided by the ASCII which contains characters on the keyboards.

now ASCII has 256 Characters, which is small. so in this case a C++ dev will use a char because a char is 8bit = 256 , imagine if I had to use a bigger data storage, I would simply be wasting memory.

Most C++ apps are highly intensive and use a lot of memory, you have to think on a compiler level, especially if you are doing 3D Engines, you can quickly max out the memory on the system. So you must be very detailed and learn about C++ before diving into it. You are also responsible for disposing of that memory, which is why most sane people jump to Java, Let the GC handle all those.

Anyway, that's my explanation for a data type and when to use them.


Int data are so good but the max is 65,536 , so if you have to handle large data, you'd be looking at the 32bit data types long,double or so

Assuming you were dealing with computation for 3D Engines or Game Dev, you will find yourself using a lot of floats.

It's important to understand Data type in C++ it's very very important




Disclaimer: I am not an experienced C++ Dev so my answers might be wrong, so open to correction.

3 Likes

Re: What Exactly Do Modifier Types In C++ Do? More Emphasis On Integer Modifiers by qtguru(m): 2:44pm On Oct 30, 2022
If you are fascinated with how C++ executes, there's a gdb debugger for Linux, it helps you see the instructions. Good ol times I swear, now it's JS someone is writing. cry
Re: What Exactly Do Modifier Types In C++ Do? More Emphasis On Integer Modifiers by TastyFriedPussy: 4:43pm On Nov 05, 2022
qtguru:
If you are fascinated with how C++ executes, there's a gdb debugger for Linux, it helps you see the instructions. Good ol times I swear, now it's JS someone is writing. cry
have you in anyway done GUI with C++ before?
Re: What Exactly Do Modifier Types In C++ Do? More Emphasis On Integer Modifiers by qtguru(m): 5:00pm On Nov 05, 2022
TastyFriedPussy:
have you in anyway done GUI with C++ before?

Qt Framework but years ago, If you're building GUI, there are more easier solution. But Qt, I also tried, MS MFC but it's convoluted.

So QT or WxWidget

All the best

Disclaimer: I am not a C++ Dev
Re: What Exactly Do Modifier Types In C++ Do? More Emphasis On Integer Modifiers by TastyFriedPussy: 5:32pm On Nov 05, 2022
qtguru:


Qt Framework but years ago, If you're building GUI, there are more easier solution. But Qt, I also tried, MS MFC but it's convoluted.

So QT or WxWidget

All the best

Disclaimer: I am not a C++ Dev
would that be a good career path, like GUI development? Are there alot of jobs for the niche?
Re: What Exactly Do Modifier Types In C++ Do? More Emphasis On Integer Modifiers by qtguru(m): 6:27pm On Nov 05, 2022
TastyFriedPussy:
would that be a good career path, like GUI development? Are there alot of jobs for the niche?

Honestly yes, but as a Nigerian , do you have the patience to study C++ for 2+ years before getting a job. C++ involves not just the language, but the build tools, the compiler you're using and OS knowledge. It's good for personal knowledge but if you're looking for a job as a C++ Dev, it's a different ball game.


My question ? Why did you pick C++ and not JS nor Java/C#
Re: What Exactly Do Modifier Types In C++ Do? More Emphasis On Integer Modifiers by TastyFriedPussy: 7:01pm On Nov 05, 2022
.

1 Like 1 Share

Re: What Exactly Do Modifier Types In C++ Do? More Emphasis On Integer Modifiers by peterincredible: 9:05am On Nov 06, 2022
TastyFriedPussy:
would that be a good career path, like GUI development? Are there alot of jobs for the niche?
noooo Bros pls don't use it as a career path especially if you are in Nigeria I was also a c++ developer 2014-16 I used Qt to then for building desktop GUI app but switched 2017 but if u want to play with it as a hubby then just continue to enjoy your yourself with it have you heard about graphics programming you can play with it took if you just want some more things to play around with c++

(1) (Reply)

This Is The First Software Programming Help-desk In Lagos / Help Test This Cool Data Visualization Web App I Made For Upcoming Gen Election / Gurus In The House Please Come In

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 29
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.