Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

i not understand your C++

53 views
Skip to first unread message

asetof...@gmail.com

unread,
Oct 25, 2015, 2:44:38 AM10/25/15
to
I not understand all your fobia
and fear for pointers...

Perhaps i not understand enough
C++ too (I use, and it is enough,
a small subset
of all the laws of C++)
and possibly i'm not too much
smart etc for understand
all the remain, and the code
I see here too.

If is the same fobia you all have
for the use of goto, the way
could be not right.

It is like I have good experiences
with pointers and goto
while all you not...
strange...

For me the only direction improve
C++ is in use fixed size type
and make more big the set
of function and operator definable
add all symbols to the language
not just a-z A-Z





cda...@gmail.com

unread,
Oct 25, 2015, 4:14:38 AM10/25/15
to
Up the voltage on your shock therapy treatment.

Jorgen Grahn

unread,
Oct 25, 2015, 4:55:08 AM10/25/15
to
On Sun, 2015-10-25, asetof...@gmail.com wrote:
> I not understand all your fobia and fear for pointers...

Whose phobia? I use pointers frequently.
There are often better alternatives, though.

> Perhaps i not understand enough C++ too (I use, and it is enough, a
> small subset of all the laws of C++) and possibly i'm not too much
> smart etc for understand all the remain, and the code I see here
> too.

You need to be more specific. You may be thinking of some recent
discussion concerning pointers and smart pointers, but it's hard to
tell.

> If is the same fobia you all have for the use of goto, the way could
> be not right.
>
> It is like I have good experiences with pointers and goto while all
> you not... strange...

For goto, it's not just the people who post in c.l.c++ -- the problems
with 'goto' have been well-known and accepted as problems at least
since Dijkstra pointed them out in the 1960s. And languages have
evolved to offer replacements since then.

> For me the only direction improve C++ is in use fixed size type and
> make more big the set of function and operator definable add all
> symbols to the language not just a-z A-Z

But in reality neither you nor I can change the language. We can either
- adapt to how others use it
- stick to a subset we're comfortable with
- stop using it.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .

asetof...@gmail.com

unread,
Oct 25, 2015, 6:19:36 AM10/25/15
to
Jorgen wrote:
But in reality neither you nor I can change the language. We can either
- adapt to how others use it
- stick to a subset we're comfortable with
- stop using it.

/Jorgen
____________
There is a easy workaround
for use all range of letters

write a program that extend macro
definitions to words any range
of char
and than after the macro substitutions
call the C++ compiler

Bo Persson

unread,
Oct 25, 2015, 7:29:11 AM10/25/15
to
Now you run into the "macro fobia", which is even more widespread than
your "pointer fobia". Trying to fix the language with macros is NOT the
way to go.


Bo Persson

Paavo Helde

unread,
Oct 25, 2015, 9:53:33 AM10/25/15
to
asetof...@gmail.com wrote in news:bbe69898-7d4b-451b-a6e0-
8623f3...@googlegroups.com:
I believe you might be in the wrong newsgroup. Try e.g. rec.arts.poems,
you might get better response there.


asetof...@gmail.com

unread,
Oct 25, 2015, 12:37:36 PM10/25/15
to
For example copy the first example
in what seems a book For C++ rules
__________
int* p = nullptr; { int i = 0; p = &i; *p = 42; // pset(p) = {null} // pset(temp) = {i}  pset(p) = {i} // ok } *p = 1; // A: KILL(i)  pset(p) = {invalid} // ERROR, p was invalidated when i went out of scope // at line A. Solution: increase i’s lifetime, or // reduce p’s lifetime
_________
I would never write the 1 example
[use the address in a function
of one variable out the scope
of that variable]
because for me all variable are to define
Just when function start
never in the middle of one function
not in for(){here}
Excuse if you see a not good
indentation, and not good code appear
it is only copy paste from here
etc and do some mess with it
cancel some part too...

Louis Krupp

unread,
Oct 25, 2015, 2:14:16 PM10/25/15
to
On Sun, 25 Oct 2015 09:36:46 -0700 (PDT), asetof...@gmail.com
wrote:

>For example copy the first example
>in what seems a book For C++ rules
>__________
> int* p = nullptr;
> {
> int i = 0;
> p = &i;
> *p = 42;
> }
> *p = 1;

You say you found this in a book. Which one?

Louis

asetof...@gmail.com

unread,
Oct 25, 2015, 3:01:04 PM10/25/15
to
The example is in the 2th PDF
if one read from above
In this link
https://github.com/isocpp/CppCoreGuidelines/tree/master/docs

asetof...@gmail.com

unread,
Oct 25, 2015, 3:53:51 PM10/25/15
to
Always in the same file I have
____________
int main() { auto x=10, y=2; auto& good = min(x,y); // ok, pset(good) == {x,y} cout << good; // ok, 2 auto& bad = min(x,y+1) // A: IN: pset(arg1)=={x}, // pset(arg2)=={temp(y+1)} // min() returns temp2 // OUT: pset(temp2) = {x,temp} ; // KILL(temp)  pset(temp2) = {invalid
____________

But why crate in a function
a reference variable
int& y;?
There is someone of you know that?

Reference are good only for pass
(as pointer) data to function
and operator (without change it)

It allow to write: x + y
where x and y are reference
In that is useful


Louis Krupp

unread,
Oct 25, 2015, 4:48:10 PM10/25/15
to
On Sun, 25 Oct 2015 12:00:36 -0700 (PDT), asetof...@gmail.com
wrote:
OK. You, the authors of C++ Core Guidelines, and the rest of the
world all agree that this is an example of what not to do.

Louis
0 new messages