[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
>64-bit works dubiously on Windows because Win changes the
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 11
Thread images: 1
File: 17 me.png (834 KB, 719x960) Image search: [Google]
17 me.png
834 KB, 719x960
>64-bit works dubiously on Windows because Win changes the size of Int and the size of addresses whereas Linux just changes the size of address.

Is this legit? What are the repercussions?
>>
>>51876552
>Is this legit?
Yes. int is only guaranteed to be at least 16 bits.

>What are the repercussions?
None, be a good C programmer and never assume anything about the underlaying architecture.
>>
>>51876582
So what happens to the size of MAX_INT on Linux? Does it stay at 32bit size, whereas on Win it will be larger?
>>
>>51876582
>Yes. int is only guaranteed to be at least 16 bits.

Well, there are the horrible preprocessor tests to determine the size of the types, but tose are icky.

When Windows API is concerned though, that's quite stable as long as one uses the WinDef.h type definitions.
>>
>>51876647
>WinDef.h
Non-portable pig disgusting.

Just use stdint.h

>>51876610
>So what happens to the size of MAX_INT on Linux? Does it stay at 32bit size,
Yes
>>
>>51876552
>Linux just changes the size of address.

I don't believe this, isn't that an age old Unix tradition that size of address = size of int?
>>
>>51876662

It's pig disgusting yes, but lesser evil when working directly with windows API when the portability can be tossed off the windows anyway.

That at least guarantees that no matter what compiler or what number of bits, the code should be able to do the right thing when interacting with the said API.
>>
>>51876665
I don't know, hence the question. It was just mentioned on some stream I was watching.

Although I always knew that size of int was never set in stone, it's soemthing that never really crossed my mind. I guess there's no reason for them to be locked togehter. Just wondering what the reasoning behind the differences are.
>>
>>51876552
>Win changes the size of Int

Does this refer to newer versions of VC++ upping the size of int to 32 bits?

I guess they have come to a conlusion that code that suffers over flow related bugs on int is more common than code that does size-dependant bit twiddling.
>>
>>51876980
Not in the slightest. If you had a computer capable of storing 2 bits then the largest int would be 2. If you had a 4bit comp then your largest int would be 16.
>>
Bait? Bait. I can't help it.

Read https://en.m.wikipedia.org/wiki/C_data_types

Basically, short int and long are based on the native bit width, and the only thing you can assume is short takes fewer bits than int, and long takes more. I'm sure some compliers and environments fuck it up in some situations, but that's the idea.

Fixed width types take away any ambiguity.

Like I said, go read.
Thread replies: 11
Thread images: 1

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.