Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #13311

Re: Using multiple files in (Borland) C

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: Using multiple files in (Borland) C
Date 2011-11-14 12:49 -0800
Organization None to speak of
Message-ID <lnk4724eg4.fsf@nuthaus.mib.org> (permalink)
References (1 earlier) <3e6d027f-b48c-42e8-88ec-89f6b0e05ccd@e2g2000vbb.googlegroups.com> <ee760e3c-ff25-44b0-bb17-2db1ea9d5503@cc2g2000vbb.googlegroups.com> <0.10c8893b9c333a9db567.20111114141638GMT.87zkfyvlfd.fsf@bsb.me.uk> <5b49f0aa-de68-477d-8f75-dd6093241977@k10g2000yqn.googlegroups.com> <0.1a808bf681343ebd8aa2.20111114163507GMT.87ty66vf0k.fsf@bsb.me.uk>

Show all headers | View raw


Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> Nick Keighley <nick_keighley_nospam@hotmail.com> writes:
[...]
>> I was making the declaration/definition distinction (perhaps
>> unwisely...). My header files usually contain complete "definitions"
>> of types.
>
> Using the language of the standard, the only thing that can be called a
> definition in relation to types is a typedef.  This is (as you know) a
> declaration that defines an identifier to be a synonym for some other
> type.  All the ways of introducing new types are just called
> declarations.  (There may be a few cases where this language is not used
> consistently, but, if there are, they must be quite rare).
>
> In short, I think it's reasonable to say that header files declare data
> types.
>
> Despite this, I agree with you.  I often describe a structure
> declaration as a type definition; even going so far as to distinguish
> between the "declaration" of an incomplete type, and the "definition" of
> a complete one.  All this despite knowing that this is not the way they
> are referred to in the language specification.
>
> I think it's pretty safe to mess with the words here because there isn't
> much scope for misunderstanding.  That's quite unlike the declare/define
> distinction for objects, which it critical.

My conclusion from the last time we discussed this was that the
Standard's definition of the word "definition", in C99 6.7p5:

    A *definition* of an identifier is a declaration for that identifier
    that:

    -- for an object, causes storage to be reserved for that object;
    -- for a function, includes the function body;
    -- for an enumeration constant or typedef name, is the (only)
       declaration of the identifier.

is tailored to the Standard's own needs.  It seems clear (to me,
at least), that

    struct foo { int x; };

is a definition of "struct foo" (i.e., it's a declaration that
causes the named entity to exist), but since the Standard doesn't
refer to it as a "definition", the definition of "definition"
doesn't cover it.  It can make it a bit difficult to discuss such
things while sticking to the terminology defined by the Standard.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Using multiple files in (Borland) C Ruud <ruud.baltissen@gmail.com> - 2011-11-11 13:59 -0800
  Re: Using multiple files in (Borland) C Keith Thompson <kst-u@mib.org> - 2011-11-11 14:33 -0800
  Re: Using multiple files in (Borland) C James Kuyper <jameskuyper@verizon.net> - 2011-11-11 17:42 -0500
    Re: Using multiple files in (Borland) C "osmium" <r124c4u102@comcast.net> - 2011-11-11 19:38 -0600
  Re: Using multiple files in (Borland) C Ruud <ruud.baltissen@gmail.com> - 2011-11-12 00:29 -0800
  Re: Using multiple files in (Borland) C Bill Reid <hormelfree@gmail.com> - 2011-11-12 11:08 -0800
    Re: Using multiple files in (Borland) C Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-14 01:54 -0800
      Re: Using multiple files in (Borland) C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-14 14:16 +0000
        Re: Using multiple files in (Borland) C Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-14 07:57 -0800
          Re: Using multiple files in (Borland) C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-14 16:35 +0000
            Re: Using multiple files in (Borland) C Keith Thompson <kst-u@mib.org> - 2011-11-14 12:49 -0800
              Re: Using multiple files in (Borland) C Tim Rentsch <txr@alumni.caltech.edu> - 2012-01-25 02:02 -0800
  Re: Using multiple files in (Borland) C Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-11-12 23:07 +0000
    Re: Using multiple files in (Borland) C Ruud <ruud.baltissen@gmail.com> - 2011-11-14 12:48 -0800

csiph-web