code style in the vfs

Pavel Tsekov ptsekov at gmx.net
Sun Sep 26 17:13:40 UTC 2004


Hello,

On Sun, 26 Sep 2004, Oswald Buddenhagen wrote:

> On Sun, Sep 26, 2004 at 10:30:02AM +0200, Pavel Tsekov wrote:
> > If you point is to use those macros to detect misuse of certain
> > functions may I suggest that you think of implementig some clean, more
> > general method which could be enabled/disabled by the programmer at
> > his choice, so that he can test its code for such errors. In short I
> > (for example) don't want to write in one case `mod_funcname' and in
> > the other just `funcname'. I prefer to write `funcname' and at some
> > point I turn on a switch and the code is automagically tested for
> > incorrect usage of `funcname'. Now it is `strchr' then it will be some
> > other function, the approach that you suggest would easily end up in a
> > mess.
> >
> i think you deeply misunderstand or at least underestimate the issue.

You are wrong. I understand the issue well and I understand why it was
introduced. Quoting, Roland:

"The few places where they weren't had mostly been introduced by me adding the
"const" qualifier without thinking further."

Then blaming it to those bad functions - strchr() and friends.

> guess why c++ has "const in, const out" and a "non-const in, non-const
> out" versions of these functions?

Why don't you enlighten me ? Do you imply that one cannot write good and
robust C code if he/she haven't heard of C++ .

> in c one can't overload, so one has to accept some inconvenience to produce
> safe code.

Writing safe code thanks to overloading - wow!



More information about the mc-devel mailing list