CPP_INTERVIEW_LIB Telegram 543
🍣 Что такое битовые поля?

Битовые поля в C++ — это способ экономии памяти, позволяющий задавать члены класса с точным размером в битах. Например, в структуре можно выделить под день недели всего 3 бита, а под день месяца — 6.

struct Date {
unsigned short nWeekDay : 3; // 0..7 (3 бита)
unsigned short nMonthDay : 6; // 0..31 (6 бит)
unsigned short nMonth : 5; // 0..12 (5 бит)
};


❗️Битовые поля могут усложнять код и отладку, а также имеют ограничения (например, нельзя получить адрес битового поля).



tgoop.com/cpp_interview_lib/543
Create:
Last Update:

🍣 Что такое битовые поля?

Битовые поля в C++ — это способ экономии памяти, позволяющий задавать члены класса с точным размером в битах. Например, в структуре можно выделить под день недели всего 3 бита, а под день месяца — 6.

struct Date {
unsigned short nWeekDay : 3; // 0..7 (3 бита)
unsigned short nMonthDay : 6; // 0..31 (6 бит)
unsigned short nMonth : 5; // 0..12 (5 бит)
};


❗️Битовые поля могут усложнять код и отладку, а также имеют ограничения (например, нельзя получить адрес битового поля).

BY Библиотека собеса по C++ | вопросы с собеседований


Share with your friend now:
tgoop.com/cpp_interview_lib/543

View MORE
Open in Telegram


Telegram News

Date: |

On June 7, Perekopsky met with Brazilian President Jair Bolsonaro, an avid user of the platform. According to the firm's VP, the main subject of the meeting was "freedom of expression." Those being doxxed include outgoing Chief Executive Carrie Lam Cheng Yuet-ngor, Chung and police assistant commissioner Joe Chan Tung, who heads police's cyber security and technology crime bureau. SUCK Channel Telegram To delete a channel with over 1,000 subscribers, you need to contact user support Other crimes that the SUCK Channel incited under Ng’s watch included using corrosive chemicals to make explosives and causing grievous bodily harm with intent. The court also found Ng responsible for calling on people to assist protesters who clashed violently with police at several universities in November 2019.
from us


Telegram Библиотека собеса по C++ | вопросы с собеседований
FROM American