Объясните пожалуйста для чего добавили новые ключевые слова в С++ 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
Здравствуйте, 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
Их наоборот, пометили как 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
Здравствуйте, swingus, Вы писали:
S>Их наоборот, пометили как deprecated, и собираются убрать совсем.
Где? Когда? Знаю что триграфы убирают. Старые функторы-адапторы/auto_ptr убирают — знаю. А чтобы alternative operators убирали — не знаю. Ссылку можно?
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
Ну, значит, альтернативные операторы не убирают. Не могу сказать, что внимательно слежу за этой частью изменений стандарта.
Здравствуйте, 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
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
Здравствуйте, 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
Здравствуйте, 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 ??=
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.