Re: Pointers to "why C behaves like that ?"

Marco van de Voort <marcov@toad.stack.nl>
11 Dec 2002 22:24:38 -0500

          From comp.compilers

Related articles
[62 earlier articles]
Re: Pointers to "why C behaves like that ?" joachim_d@gmx.de (Joachim Durchholz) (2002-12-03)
Re: Pointers to "why C behaves like that ?" vugluskr@unicorn.math.spbu.ru (Roman Shaposhnick) (2002-12-07)
Re: Pointers to "why C behaves like that ?" vugluskr@unicorn.math.spbu.ru (Roman Shaposhnick) (2002-12-07)
Re: Pointers to "why C behaves like that ?" lex@cc.gatech.edu (Lex Spoon) (2002-12-11)
Re: Pointers to "why C behaves like that ?" joachim_d@gmx.de (Joachim Durchholz) (2002-12-11)
Re: Pointers to "why C behaves like that ?" marcov@toad.stack.nl (Marco van de Voort) (2002-12-11)
Re: Pointers to "why C behaves like that ?" marcov@toad.stack.nl (Marco van de Voort) (2002-12-11)
Re: Pointers to "why C behaves like that ?" lth@acm.org (Lars T Hansen) (2002-12-11)
Re: Pointers to "why C behaves like that ?" torbenm@diku.dk (2003-01-17)
Re: Pointers to "why C behaves like that ?" ralph@inputplus.co.uk (2003-03-17)
Re: Pointers to "why C behaves like that ?" skeeterdabeeterbunny@ameritech.net (skeeter da beeter bunny) (2003-03-22)
| List of all articles for this month |

From: Marco van de Voort <marcov@toad.stack.nl>
Newsgroups: comp.compilers
Date: 11 Dec 2002 22:24:38 -0500
Organization: Eindhoven University of Technology, The Netherlands
References: 02-11-059 02-11-083 02-11-100 02-11-109 02-11-135 02-11-142
Keywords: types, practice
Posted-Date: 11 Dec 2002 22:24:38 EST

thp@cs.ucr.edu wrote:
> Dr A. N. Walker <anw@merlot.uucp> wrote:
> + Charles Bryant <r368714668.ch@chch.demon.co.uk> wrote:
> +><thp@cs.ucr.edu> wrote:
> +>> Agreed. It's as though the compiler is continually giving an
> +>> impromptu quizzes to the programmer, [...]
> +>However the compiler is acting on behalf of all the future maintenance
> +>programmers who would be quizzing the original programmer if only they
> +>could travel back in time.
> +
> + I think there is a danger of assuming that all programs fit
> + one familiar model. Your environment may be one in which the needs of
> + maintenance programmers are important. Mine is not. It used to be;
> + especially from the point of view that my maintenance programmer could
> + be me, six months down the line when I've forgotten how the code
> + worked. But these days, my programs are usually small run-once
> + thinggies, or small do-some-simple-task thinggies, and they will
> + never be "maintained" in the way that an operating system is.
> + Increasingly, my big "programs" in fact consist of bundles of shell
> + scripts with occasional diddy-C stuff mixed in.
>
> This difference of opinion is reminds me of the recurring question of
> whether it is better to pass variables by pointer or by reference.
> The argument goes that, while the original programmer might prefer to
> write "increment(n)" rather than "increment(&n)",


But the compiler/lint could provide even more info than that if the
declaration of increment specified in/out/inout. So I think that is a
bogus argument.


E.g. Delphi with the compiler effectively being used in the syntax
highlighting could produce this kind of info quite nicely to the
maintainer.


> the latter form tells maintenance programmers, and perhaps the even
> original programmer, that the call to increment can change the value of n.
> Similar arguments were also made in favor of the Hungarian naming
> convention, where names of variables were mangled a bit to indicate their
> types.


The Hungarian notation argument is endless, but I personally don't
like it, maybe except when enforced by the compiler.


I don't want to risk the previous maintainer to change a type of a
var, but not the varname to match.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.