[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: 1735562237882732.png (172 KB, 500x500)
172 KB
172 KB PNG
C is just a glorified assembly macro
>>
>>107730998
>Misses a significant number of instructions
>>
>>107730998
how do I check the overflow flag in C?
>>
>>107731032
Intrinsics for addition with overflow checking, but you will generate assembly output so horrifying that if you care about code quality at all you will either just use a 64-bit (or the next larger) type or force yourself to just learn inline ASM syntax. But some stuff doesn't have intrinsics for flag checking. E.g.left and right shift instructions can set overflow based on the last lost digit so you can use it to get 33 bits of precision even though you only have a 32-bit register. This is useful for rounding using an add with carry for example.
>>
>>107731032
With a C23 macro called ckd_add.
>>
No, C is lazy assembly: when you trust that the compiler is better at optimizing than you are.
C harmful? Now you don't learn how to optimize!
>>
>>107730998
If it really was just a glorified assembler syntax then it wouldn't be portable now would it
>>
>>107730998
No, it's a shitty compiled language. C has nothing in common with assembly.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

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.