Skip to content

Commit 01b66d9

Browse files
committed
unique variable names in example
1 parent bf11606 commit 01b66d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CppCoreGuidelines.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16181,7 +16181,7 @@ Note that a C-style `(T)expression` cast means to perform the first of the follo
1618116181
##### Example, bad
1618216182

1618316183
std::string s = "hello world";
16184-
double* p = (double*)(&s); // BAD
16184+
double* p0 = (double*)(&s); // BAD
1618516185

1618616186
class base { public: virtual ~base() = 0; };
1618716187

@@ -16194,7 +16194,7 @@ Note that a C-style `(T)expression` cast means to perform the first of the follo
1619416194
};
1619516195

1619616196
derived1 d1;
16197-
base* p = &d1; // ok, implicit conversion to pointer to base is fine
16197+
base* p1 = &d1; // ok, implicit conversion to pointer to base is fine
1619816198

1619916199
// BAD, tries to treat d1 as a derived2, which it is not
1620016200
derived2* p2 = (derived2*)(p);

0 commit comments

Comments
 (0)