Re: typedef in a struct



Hi,

The fact you don't like typedef is a style and has nothing to do with
c++. The style of c you prefer is just fine in a c++ file.

OK, so why should I use C++ when in fact all I need is simple C?

It's not I don't like typedef, I just like clean, readable code. And that doesn't extend to C/C++ only.

In my oppinion the use (or the not using) of tools (and C++ provides many tools) should be appropriate to solve the problem. That's code quality. If you can do it in C that's fine. If you need C++ that's also fine.

But sometimes you're restricted to C only by external constraints (for example when you code for some embedded system which only provides you with a plain C compiler).

So it is nonsense to write everything in C++ just because it provides you with some fancy tool - many of them have been "backported" already, but some just make no sense.

You see, just recently I saw an article in a popular computer magazine which stated that you are not allowed to use pointers in C because of the Professor-of-computer-science-Mr.-Nobody's-programming-principle. To avoid making errors. OK, this guy obviously never managed to work with pointers - but why should I not use them when they work most conveniently? Somebody telling me *not* to use something because it's "bad" in my eyes never understood (a) the principle of all tools being there for using them and (b) the tool he detests.

You see, I don't like Matlab because the interpreter has no type-checking whatsoever (and it's much too expensive). But why shouldn't somebody use it who feels comfy?

So if you feel more comfy with C++ that's fine with everybody, but don't expect others to feel the same way. Even if it's "better" for you it may be "worse" for the next guy.

Ciao...

.



Relevant Pages

  • Re: Almost Forgot How Obtuse C++ Can Be
    ... C/C++ is very convenient for software that needs to be ... programmed in a low-level manner. ... pointers, byte-fields, bit-shifting, memory-access by pointers, ... low-level programming. ...
    (borland.public.delphi.non-technical)
  • Re: Indirect referencing in VB6
    ... It does use pointers though - what about when you pass a value byref, ... is the VB equivalent of a C/C++ program passing a pointer. ... >> It's a style supported, and encouraged, in some other language systems ...
    (microsoft.public.vb.general.discussion)
  • Re: Pointers and Optimization
    ... It is my understanding that one advantage of Fortran pointers compared ... to C/C++ pointers is that Fortran pointers don't harm optimization as ... But come to think of it, the C/C++ compiler ...
    (comp.lang.fortran)
  • Pointers and Optimization
    ... It is my understanding that one advantage of Fortran pointers compared to C/C++ pointers is that Fortran pointers don't harm optimization as much. ...
    (comp.lang.fortran)