для чего добавили новые ключевые слова в С++11
От: sergey2b ЮАР  
Дата: 15.11.15 03:37
Оценка: -2
Объясните пожалуйста для чего добавили новые ключевые слова в С++ 11

Note that and, bitor, or, xor, compl, bitand, and_eq, or_eq, xor_eq, not, and not_eq (along with the digraphs <%, %>, <:, :>, %:, and %:% provide an alternative way to represent standard tokens.
Re: для чего добавили новые ключевые слова в С++11
От: Zhendos  
Дата: 15.11.15 03:54
Оценка: 2 (1) +3
Здравствуйте, sergey2b, Вы писали:

S>Объясните пожалуйста для чего добавили новые ключевые слова в С++ 11


S>Note that and, bitor, or, xor, compl, bitand, and_eq, or_eq, xor_eq, not, and not_eq (along with the digraphs <%, %>, <:, :>, %:, and %:% provide an alternative way to represent standard tokens.


Почему добавлены и новые? Например в стандарте c++2003 в параграфе 2.5 все эти `bitor`, `and`
перечислены и сказано что они могут использоваться как альтернатива `|`, `&&` и т.д.,
и скорее всего эти символы были введены давно как триграфы, для тех клавиатур (языков, локалей)
где трудно использовать символы типа `|` или `&`
Re: для чего добавили новые ключевые слова в С++11
От: swingus  
Дата: 15.11.15 11:54
Оценка:
Их наоборот, пометили как deprecated, и собираются убрать совсем.

Здравствуйте, sergey2b, Вы писали:

S>Объясните пожалуйста для чего добавили новые ключевые слова в С++ 11


S>Note that and, bitor, or, xor, compl, bitand, and_eq, or_eq, xor_eq, not, and not_eq (along with the digraphs <%, %>, <:, :>, %:, and %:% provide an alternative way to represent standard tokens.
Re[2]: для чего добавили новые ключевые слова в С++11
От: Alexey F  
Дата: 15.11.15 12:49
Оценка:
Здравствуйте, swingus, Вы писали:

S>Их наоборот, пометили как deprecated, и собираются убрать совсем.


Где? Когда? Знаю что триграфы убирают. Старые функторы-адапторы/auto_ptr убирают — знаю. А чтобы alternative operators убирали — не знаю. Ссылку можно?

Даже "IBM comment on preparing for a Trigraph-adverse future in C++17" жалуется:

In that paper, we analyzed the problem, looked in-depth at various solutions and explain why
alternatives like digraphs and alternative spelling operators are no replacement for trigraphs.

Re[3]: для чего добавили новые ключевые слова в С++11
От: swingus  
Дата: 15.11.15 13:08
Оценка:
Ну, значит, альтернативные операторы не убирают. Не могу сказать, что внимательно слежу за этой частью изменений стандарта.

Здравствуйте, Alexey F, Вы писали:

AF>Здравствуйте, swingus, Вы писали:


S>>Их наоборот, пометили как deprecated, и собираются убрать совсем.


AF>Где? Когда? Знаю что триграфы убирают. Старые функторы-адапторы/auto_ptr убирают — знаю. А чтобы alternative operators убирали — не знаю. Ссылку можно?


AF>Даже "IBM comment on preparing for a Trigraph-adverse future in C++17" жалуется:

AF>

AF>In that paper, we analyzed the problem, looked in-depth at various solutions and explain why
AF>alternatives like digraphs and alternative spelling operators are no replacement for trigraphs.

Re: для чего добавили новые ключевые слова в С++11
От: Alexey Sudachen Чили  
Дата: 15.11.15 16:20
Оценка:
S>Объясните пожалуйста для чего добавили новые ключевые слова в С++ 11
S>Note that and, bitor, or, xor, compl, bitand, and_eq, or_eq, xor_eq, not, and not_eq (along with the digraphs <%, %>, <:, :>, %:, and %:% provide an alternative way to represent standard tokens.

{
    doit() or die;
}


А чё, мне нравится =).
Re: для чего добавили новые ключевые слова в С++11
От: Abyx Россия  
Дата: 15.11.15 18:31
Оценка:
Здравствуйте, sergey2b, Вы писали:

S>Объясните пожалуйста для чего добавили новые ключевые слова в С++ 11

S>Note that and, bitor, or, xor, compl, bitand, and_eq, or_eq, xor_eq, not, and not_eq (along with the digraphs <%, %>, <:, :>, %:, and %:% provide an alternative way to represent standard tokens.

они там были всегда.
все (ломающие) изменения можно посмотреть в разделе diff стандарта — http://eel.is/c++draft/#diff
In Zen We Trust
Отредактировано 15.11.2015 18:32 Abyx . Предыдущая версия .
Re[3]: для чего добавили новые ключевые слова в С++11
От: Ops Россия  
Дата: 15.11.15 19:20
Оценка: +1
Здравствуйте, Alexey F, Вы писали:

AF>Даже "IBM comment on preparing for a Trigraph-adverse future in C++17" жалуется:


Это что ж у них за говно мамонта в коде?
Переубедить Вас, к сожалению, мне не удастся, поэтому сразу перейду к оскорблениям.
Re[4]: для чего добавили новые ключевые слова в С++11
От: Alexey F  
Дата: 15.11.15 20:48
Оценка: 4 (1) :)
Здравствуйте, Ops, Вы писали:

Ops>Это что ж у них за говно мамонта в коде?


Appendix A из PDF 2009 года на которую они ссылаются:

Trigraph deprecation is vexing for existing world-wide companies (of which IBM is one such user) because of their use of EBCDIC variant code pages. It makes it difficult to start in a code page neutral manner, establish what the active code page is, then start using invariant characters. We use a pragma filetag("IBM-1047") to toggle the code page, then we can use #. Prior to that we are in a code page neutral environment and must use the trigraph ??=

??=ifndef _DEQUE_T
??=if defined(__MVS__)
??=if defined(__COMPILER_VER__)
??=pragma filetag("IBM-1047")
#endif /* defined(__COMPILER_VER__) */

Trigraph '??=' is used at the beginning of the source because the code point for '#' differs across various EBCDIC code pages. And without the filetag pragma, the compiler assumes the codepage is IBM-1047 (the default EBCDIC codepage). '?' share the same code point across all EBCDIC code pages, and so does '='. Therefore the trigraph is used to represent '#'. By the same token, the digraph %: also has the same property, so it may be reasonable to replace the existing trigraph with digraphs. I will show later that this too is not enough in the context inside other tokens.

...

В теле документа:

The biggest argument against deprecating trigraph is the fact that we know there are source code from world-wide companies, based on an internal survey of our customer problem reports that make heavy use of trigraphs for one reason or another, and customer testimonials. Google code search doesn't find them because these are proprietary code.

 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.