[SystemSafety] C++ and Pointers
Peter Bernard Ladkin
ladkin at causalis.com
Wed Jun 5 12:36:54 CEST 2019
There is a chap called Alex, who did his degree at UC Davis and also taught some programming there.
He has a readable WWW site introducing C++ , https://www.learncpp.com
It has been a while; I just looked up a couple of things about pointers, in Section 6. Some of the
things he says - he needs to say - sent shivers up my spine.
He points out that keysymbols "*" and "&" are overloaded. Let's just consider "*". "Although the
dereference operator looks just like the multiplication operator, you can distinguish them because
the dereference operator is unary, whereas the multiplication operator is binary."
But that of course is not the only overloading. He goes on to explain declarations, which also use
keysymbol "*". "int* iPtr"; "int * iPtr"; and "int *iPtr" all have exactly the same meaning.
However, "int* iPtr1, iPtr2" is not equivalent to "int *iPtr1; int *iPtr2"; but rather to "int
*iPtr1; int iPtr2".
You need a static analyser just to tell you what your program means!
PBL
Prof. Peter Bernard Ladkin, Bielefeld, Germany
MoreInCommon
Je suis Charlie
Tel+msg +49 (0)521 880 7319 www.rvs-bi.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.techfak.uni-bielefeld.de/mailman/private/systemsafety/attachments/20190605/d3e78e73/attachment.sig>
More information about the systemsafety
mailing list