Re: question about struct??




Keith Thompson wrote:
Only if you follow as strict convention of using typedefs for pointers
but not for structs. I've never heard of anyone using such a
convention.

Seeing the "*" in the prototype would tell you much more clearly that
the argument is being passed by reference (actually that a pointer is
being passed by value, with the effect of the pointed-to object being
passed by reference).

How does the name "cobject" tell you that it's a pointer type?

The name doesn't tell it: the fact that it's a non-reserved identifier,
does.


Using the name "cobject" rather than "struct v_cobject*" saves you
some typing, but it makes your code more difficult to read.

Reading code isn't reading English. and I find that reading both
requires a different manner of thinking. When reading code, I want to
read code, not a document. So even if I use conventions that make it
not instantly apparent as to what my code does, I think that in the
long run, if someone takes the time to learn said conventions, they'll
have an easier time grasping the code. My coding philosophy is to
condense things into compact units and use contractions and
abreviations as much as I can get away with, as this makes the code
easier to retain conceptually when thinking about it It's harder to
read at first glance, but easier to recall later.

Anyway, I think I almost drifted off-topic there.

.



Relevant Pages

  • Re: Suffix _T for types found good
    ... meaningless and go on to use Index_Value as being more informative. ... And yes the way I read it is in the natural language way: ... It makes reading code that follows these conventions a lot easier ... It makes reading code that does not follow these conventions harder ...
    (comp.lang.ada)
  • Re: Suffix _T for types found good
    ... It makes reading code that follows these conventions a lot easier ... It makes reading code that does not follow these conventions harder ... If you review a lot of other people's code, you tend to learn how to look past ... The Rhythm has control. ...
    (comp.lang.ada)
  • Re: [PATCH] getsockopt() early argument sanity checking
    ... Maybe some setsockopt() doesn't care about the optlen pointer? ... conventions and sometimes protect against a stupid bug in one of the multiple ... If this is that dumb, then why is it done twice in tcp_getsockoptfor ...
    (Linux-Kernel)
  • Re: strange behaviour
    ... > this is not at all clear that its a pointer ... conventions out the window and name the root of the class hierarchy ... Groetjes, ... Maarten Wiltink ...
    (comp.lang.pascal.delphi.misc)