abbra: (Default)
[personal profile] abbra
Не хотите больше быть программистом? Оставьте свой след в истории:
http://blog.8thlight.com/dariusz-pasciak/2012/07/03/dereferencing-null-pointer-without-a-seg-fault.html

После того, как прочитали, заходите под кат и ответьте на вопрос: Скажите, а вас учили, что оператор -> над классами в C++ эквивалентен разыменованию указателя в C?

Что интересно, в стандарте С++ в 5.2.5 (Class member access) в третьем абзаце написано:
If E1 has the type “pointer to class X,” then the expression E1->E2 is converted to the equivalent form (*(E1)).E2; the remainder of 5.2.5 will address only the first option (dot).

Правда, 13.5.6 (Class member access) говорит уже более аккуратно об этом:
An expression x->m is interpreted as (x.operator->())->m for a class object x of type T if T::operator->() exists and if the operator is selected as the best match function by the overload resolution mechanism (13.3)

Date: 2012-07-11 10:00 am (UTC)
tobotras: (Default)
From: [personal profile] tobotras
Спасибо :)

April 2016

S M T W T F S
     12
3456789
1011121314 1516
17181920212223
24252627282930

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 1st, 2025 02:13 am
Powered by Dreamwidth Studios