sizeof enum
От: icWasya  
Дата: 14.03.06 15:02
Оценка:
enum en_SpeedMode{SP_Fast , SP_Slow };


чему равно sizeof(en_SpeedMode);
Re: sizeof enum
От: Сергей Мухин Россия  
Дата: 14.03.06 15:04
Оценка:
Здравствуйте, icWasya, Вы писали:



W>
W>enum en_SpeedMode{SP_Fast , SP_Slow };
W>


W>чему равно sizeof(en_SpeedMode);


sizeof( int )
---
С уважением,
Сергей Мухин
Re: sizeof enum
От: ekamaloff Великобритания  
Дата: 14.03.06 15:07
Оценка: 1 (1)
Здравствуйте, icWasya, Вы писали:



W>
W>enum en_SpeedMode{SP_Fast , SP_Slow };
W>


W>чему равно sizeof(en_SpeedMode);


Стандарт:

7.2 Enumeration declarations
...
6 The underlying type of an enumeration is an integral type that can represent all the enumerator values defined in the enumeration.
If no integral type can represent all the enumerator values, the enumeration is ill-formed. It is implementation defined
which integral type is used as the underlying type for an enumeration except that the underlying type shall not
be larger than int unless the value of an enumerator cannot fit in an int or unsigned int. If the enumerator-list
is empty, the underlying type is as if the enumeration had a single enumerator with value 0. The value of sizeof()
applied to an enumeration type, an object of enumeration type, or an enumerator, is the value of sizeof() applied to
the underlying type.


В-общем implementation-defined.
It is always bad to give advices, but you will be never forgiven for a good one.
Oscar Wilde
Re: sizeof enum
От: Bell Россия  
Дата: 14.03.06 15:07
Оценка: 1 (1)
Здравствуйте, icWasya, Вы писали:



W>
W>enum en_SpeedMode{SP_Fast , SP_Slow };
W>


W>чему равно sizeof(en_SpeedMode);



7.2/5
The underlying type of an enumeration is an integral type that can represent all 
the enumerator values defined in the enumeration. It is implementation-defined 
which integral type is used as the underlying type for an enumeration except 
that the underlying type shall not be larger than int unless the value of an 
enumerator cannot fit in an int or unsigned int. If the enumerator-list is empty, 
the underlying type is as if the enumeration had a single enumerator with value 0. 
The value of sizeof() applied to an enumeration type, an object of enumeration type, 
or an enumerator, is the value of sizeof() applied to the underlying type.
Любите книгу — источник знаний (с) М.Горький
Re: sizeof enum
От: TSS Россия http://www.sdl.ru
Дата: 14.03.06 15:10
Оценка:
Здравствуйте, icWasya, Вы писали:

W>
W>enum en_SpeedMode{SP_Fast , SP_Slow };
W>


W>чему равно sizeof(en_SpeedMode);


sizeof (int) =)

зы. любитель заманухи кидать? =)))
... << RSDN@Home 1.1.4 stable SR1 rev. 568>>
Signed, [TSS] /SDL/
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.