TCPL 5.9.9 (C++): Where would it make sense to use a name in its own initializer? -


This is a question from the most recent version of Strawstrup's "C + Programming Language".

I have been thinking this in my head for the last few days.

The only thing I can come up with (and maybe this is wrong) is something like this:

  int * f (int n) {int * a = And a - n * sizeof (int *); Return; }  

My intention is to get some top address on the stack. Does this make any sense? Does anyone else have any other answer? Remember, this is in chapter 5 (signs, arrays, and structures), so in the book nothing should be included later in the book.

Only one (difficult) fair case I know that when you point a point on the object to your constructor For example, say you have a cyclic link list node:

  class node {public: node (Next node *): Next (Next) {} Private: Node * next; };  

And you want to create a single-element cyclic list on the stack. You can:

  node n (& amp; n);  

Some other examples that are not really practical (i do not think why you need that thing), but otherwise valid:

  Int n = sizeof (n); Zero * P = & amp; P;  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -