|
WinAVR инициализирует все переменные!, Нельзя ли избавить его от этого глупого занятия? |
|
|
|
 |
Ответов
|
Apr 25 2008, 11:39
|
Знающий
   
Группа: Участник
Сообщений: 596
Регистрация: 26-05-06
Из: Москва
Пользователь №: 17 484

|
Цитата(777777 @ Apr 25 2008, 15:27)  сабж, собсно... Это гупостью он занимаеться, для того чтобы соответствовать стандарту языка С. Анатолий.
|
|
|
|
|
Apr 25 2008, 13:56
|
Знающий
   
Группа: Участник
Сообщений: 596
Регистрация: 26-05-06
Из: Москва
Пользователь №: 17 484

|
Цитата(777777 @ Apr 25 2008, 15:56)  Да ну, давно ли? Может еще пунктик стандарта укажете, в котором это предписывается? JTC1/SC22/WG14 - Chttp://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdfЦитата WG14/N1124 Committee Draft — May 6, 2005 ISO/IEC 9899:TC2 ... 6.7.8 Initialization ... 10 If an object that has automatic storage duration is not initialized explicitly, its value is indeterminate. If an object that has static storage duration is not initialized explicitly, then: — if it has pointer type, it is initialized to a null pointer; — if it has arithmetic type, it is initialized to (positive or unsigned) zero; — if it is an aggregate, every member is initialized (recursively) according to these rules; — if it is a union, the first named member is initialized (recursively) according to these rules.
|
|
|
|
|
Apr 25 2008, 14:48
|

Нечётный пользователь.
     
Группа: Свой
Сообщений: 2 033
Регистрация: 26-05-05
Из: Бровари, Україна
Пользователь №: 5 417

|
Цитата(777777 @ Apr 25 2008, 14:56)  Да ну, давно ли? Может еще пунктик стандарта укажете, в котором это предписывается? ... А в С++ он тоже инициализирует? Сначала обнуляет всю память, а котом начинает вызывать конструкторы? Несколько глупо, не так ли? А разве avr-gcc зануляет ВСЮ память? Цитата(aesok @ Apr 25 2008, 16:56)  До кучи, стандарт С 1989 года (почти 20 лет!): http://megaton.obfuscated.net/~orange/deve...raft.html#3.5.7Цитата 3.5.7 Initialization ... If an object that has static storage duration is not initialized explicitly, it is initialized implicitly as if every ember that has arithmetic type were assigned 0 and every member that has pointer type were assigned a null pointer constant. If an object that has automatic storage duration is not initialized explicitly, its value is indeterminate. Насколько я помню, в до-ansi-шном С на "Электронике-60" было так же. Теперь стандарт С++ Цитата 8.5 Initializers ... 5 To zero-initialize an object of type T means: — if T is a scalar type (3.9), the object is set to the value of 0 (zero) converted to T; — if T is a non-union class type, each nonstatic data member and each base-class subobject is zeroinitialized; — if T is a union type, the object’s first named data member89) is zero-initialized; — if T is an array type, each element is zero-initialized; — if T is a reference type, no initialization is performed. To default-initialize an object of type T means: — if T is a non-POD class type (clause 9), the default constructor for T is called (and the initialization is ill-formed if T has no accessible default constructor); — if T is an array type, each element is default-initialized; — otherwise, the object is zero-initialized. default-инициализация применяется тогда, когда инициализатор не задан явно.
--------------------
Ну, я пошёл… Если что – звоните…
|
|
|
|
Сообщений в этой теме
777777 WinAVR инициализирует все переменные! Apr 25 2008, 11:27  zltigo Цитата(777777 @ Apr 25 2008, 13:56) Значи... Apr 25 2008, 13:16   777777 Цитата(zltigo @ Apr 25 2008, 17:16) Сущес... Apr 25 2008, 15:16    MrYuran Цитата(777777 @ Apr 25 2008, 18:16) Вообщ... Apr 25 2008, 15:24     777777 Цитата(MrYuran @ Apr 25 2008, 19:24) Откр... Apr 28 2008, 04:12      zltigo Цитата(777777 @ Apr 28 2008, 06:12) Нельз... Apr 28 2008, 05:47       777777 Цитата(zltigo @ Apr 28 2008, 09:47) Нельз... Apr 28 2008, 06:52        Сергей Борщ Цитата(777777 @ Apr 28 2008, 09:40) Посто... Apr 28 2008, 07:08         777777 Цитата(Сергей Борщ @ Apr 28 2008, 11:08) ... Apr 28 2008, 07:26          Сергей Борщ Цитата(777777 @ Apr 28 2008, 10:26) Дважд... Apr 28 2008, 07:47           zltigo Цитата(Сергей Борщ @ Apr 28 2008, 09:47) ... Apr 28 2008, 09:39            Сергей Борщ Цитата(zltigo @ Apr 28 2008, 12:39) Не бу... Apr 28 2008, 11:24             zltigo Цитата(Сергей Борщ @ Apr 28 2008, 13:24) ... Apr 28 2008, 11:36          xelax Цитата(777777 @ Apr 28 2008, 11:26) Дважд... Apr 28 2008, 07:52      xelax Цитата(777777 @ Apr 28 2008, 08:12) Во-вт... Apr 28 2008, 06:00    zltigo Цитата(777777 @ Apr 25 2008, 17:16) Вообщ... Apr 25 2008, 16:08     singlskv Цитата(zltigo @ Apr 25 2008, 20:08) Прогр... Apr 25 2008, 16:40      zltigo Цитата(singlskv @ Apr 25 2008, 18:40) быв... Apr 25 2008, 16:55       singlskv Цитата(zltigo @ Apr 25 2008, 20:55) Типа ... Apr 25 2008, 18:42        IgorKossak Цитата(singlskv @ Apr 25 2008, 21:42) каж... Apr 25 2008, 19:23         singlskv Цитата(IgorKossak @ Apr 25 2008, 23:23) Н... Apr 25 2008, 19:33        zltigo Цитата(singlskv @ Apr 25 2008, 20:42) Ну ... Apr 25 2008, 19:40         singlskv Цитата(zltigo @ Apr 25 2008, 23:40) Это в... Apr 25 2008, 19:56 MrYuran где-то я это уже видел...
не помню где...
вроде ка... Apr 25 2008, 12:56 Aleksandr Baranov Так ведь это уже обсуждалось пару дней назад.
The... Apr 25 2008, 13:43 singlskv Цитата(Aleksandr Baranov @ Apr 25 2008, 17... Apr 25 2008, 14:09
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0
|
|
|