📜 ⬆️ ⬇️

About C ++ Location

Good evening
In recent days, the C ++ blog has revived, and a lot of new topics and debates have arisen about the place of C ++ in our life, its future and past. I want to say something about this. I write mainly on C for all kinds of PIC18 glands from Microchip, but I am also familiar with C ++. And I think that it is impossible to consider C ++ in isolation from C capabilities, if only because it was designed as the heir of S.
In this regard, I would like to ask a question to all those who say that C ++ will die and that similar tasks can be easily solved in Python / Java / Haskel, etc. Show how in your favorite programming language you can get the most significant byte of 32-bit (for example) numbers per processor cycle.
My solution in C / C ++:
int number;
char mByte=*(((char*)&number)+3);

guaranteed to be compiled into a single-instruction manual on almost any “what’s your processor”? Welcome to the comments.

')

Source: https://habr.com/ru/post/111258/


All Articles