> SS> I hate five major things about C++ so far:
> SS> /* 1. Passing by reference */
> SS> /* 2. Declaring data in random places */
> These are two of the reasons I never use pure C
> anymore. I feel limited
> without these abilities. I really hope these, along
> with function
> overloading, get added to the next C standard.
> References are quite powerful. I suspect that once
> you get used to them
> and really start using classes, you'll come to
> appreciate them as well.
It is more like syntax sugar to me. Instead of writing *var in the
argument definition and *var where you use it, you just write &var and
use var without anything indicating that you could possibly modify something
that should be outside of your reach. I use 'const &' declarations
whenever possible, so hopefully compiler prevents me to mess up something.
Code generated using both declarations (type & and type *) should be 99% (or
more) same.
> As for declarations, why shouldn't I be able to
> declare a variable where
> I use it? I especially like for(int i = 0; i < 100;
> i++) type
> declarations. It makes it quite clear that i is
> simply a placeholder.
I don't like the idea too much. When you find some variable in the middle
of the program, you can't find declaration in few logical steps (the compound
statement where this line was in, then the compound statement where this
compound statement was in, and so on, you have to scan backwards to the
beginning of the function, and the for (int i...) is not so obvious
declaration to be noticed at the first pass.
---
---------------
* Origin: A point in the middle of nowhere (2:490/31.3100)
|