Re: keyword extern

From: Minti (mintiSPAMBLOCK_at_yahoo.com)
Date: 06/26/04


Date: 26 Jun 2004 13:37:30 -0700

Emmanuel Delahaye <emdelYOURBRA@noos.fr> wrote in message news:<Xns951474F0A1393hsnoservernet@212.27.42.72>...
> In 'comp.lang.c', umbs.sairam@gmail.com wrote:
>
> > One of the purposes of using extern in multiple files is restricting
> > the visibility of the variable only to the file that needs to "see"
> > it.
>
> It certainely is a bad practice. What if the type changes (int to long, float
> to double, etc.) ? Because the compiler has no way to check the consistency
> of the code, if you miss a change the code becomes inconsitent. This practice
> is obviously wrong.
>
> If you are concerned with the visibility of the global variables, which
> is a good thing, there are other options:
>
> - don't use global at all. (Use ADT's)

Could you elucidate this point?

-- 
Imanpreet Singh Arora
isingh AT acm DOT org


Relevant Pages

  • Re: keyword extern
    ... >> It certainely is a bad practice. ... What if the type changes (int to long, ... Because the compiler has no way to check the consistency ... Dan Pop ...
    (comp.lang.c)
  • Re: Add pointer to a double linked-list?
    ... It is a good practice to put the declarations of the functions that you ... would like to share across multiple files into a header file. ...
    (comp.lang.c)
  • Re: yes
    ... Or were you restricting your claims? ... the practice of clitoridectomy was actually promoted in the United States ...
    (alt.machines.cnc)
  • Re: Restricting user from Internet email
    ... meant to post this to the SBS 2003 NG. ... > Is the current best practice for restricting a user from sending or ... > receiving Internet email still as per ...
    (microsoft.public.backoffice.smallbiz2000)