This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using C++ in GCC is OK


On Mon, May 31, 2010 at 12:59 PM, Robert Dewar <dewar@adacore.com> wrote:
> åææ wrote:
>>
>> On Mon, May 31, 2010 at 6:41 PM, Robert Dewar <dewar@adacore.com> wrote:
>>
>>> It's a pity to exclude namespaces, the advantage of breaking the
>>> single-big-namespace model are evident.
>>
>> Yes, the advantage of namespace is obvious.
>>
>> But, I think namespace is just a syntax sugar. You can name your
>> variables, functions, classes properly Âto Â"avoid" it.
>
> All of OO is just syntactic sugar :-)
> You can mimic anything in C, the point is that it obscures the
> code, this kind of naming obscures the code, so it is better
> avoided.

Indeed.  Like the funny names you start to invent when you
have wrappers that allow different kind of argument types for
a common worker.  Like building a points-to constraint in
tree-ssa-structalias.c, those have two args which technically
can be either of type int, of type varinfo_t or of type
struct constraint_expr ...  The most convenient variant
would be auto-conversion to struct constraint_expr, but even
an explicit constructor call would be ok.  Or simply
use function overloading for a sub-set of all argument type
combinations.

The same applies to functions operating on HWI vs.
double-int vs. tree integer constants vs. RTL integer constants.
Where at that point the question is whether we want to
allow operator overloading.  (No would be my answer)

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]