Re: Quantized Indexing Source Code (update & alg. history)



On Tue, 17 Jan 2006 09:50:43 -0000, Jasen Betts <jasen@xxxxxxxxxxx>
wrote:
(about nightlight's C code)
> the ones I referred to above mentioned above were globals not specifically
> initialised, on linux they get zero (beacuse all user ram starts that way)
> and presumably on windows too (because the code works for you) but I'm not
> certain that they are zeroed all C enviroments.
>
As already said, yes this is required by standard C. Although you can
find some nonstandard (nonconforming) implementations of C for very
limited (embedded) systems which might not do this.

> Also variables declared in headers but not extern, this seems to be more of
> a style issue as i've always seen them declared extern, but declared normal
> seems to work fine.
>
This however is not (unless the header is used in only one place).
Some systems, probably most nowadays, use "common" linking (named
after the FORTRAN feature it supports), where if you define (allocate)
the same variable (the same way) in multiple translation units
(separately compiled files/modules) it "merges" them, but C also
permits other forms such as the "export/import" model where if you
have multiple definitions it won't link. There are also systems where
if you have conflicting definitions it just arbitrarily and without
warning picks one of them -- but you shouldn't have conflicting
definitions by #include'ing the same header unless the code
(declaration) in that header depends on macros or types that are
defined differently in the different #include'rs, which is really bad
programming style because it confuses hell out of human readers.

- David.Thompson1 at worldnet.att.net
.



Relevant Pages

  • Re: regarding external function(Ss)
    ... than having a "#include" for the header file that declares it. ... extern void *malloc; ... effectively copies the contents of that header into your source file. ... declaration is from an included header or from the source file itself. ...
    (comp.lang.c)
  • Re: enum variables and extern
    ... Now when I try to reference enum_var in data.h, ... You need to define 'enum myenum' everywhere you reference it. ... single declaration can be convenient, ... The problem here is that it's in a header, ...
    (comp.lang.c)
  • Re: innerHTML = responseText generates invalid chars
    ... a character set declaration in properly served markup, ... served with a proper Content-Type header, ... You are confusing the Document Character Set and the document encoding, ... describes the range of characters that can be displayed with an HTML document. ...
    (comp.lang.javascript)
  • Re: [PATCH v3] ftrace: add a tracepoint for __raise_softirq_irqoff()
    ... On Mon, 11 May 2009, Mathieu Desnoyers wrote: ... Circular header dependencies is a real problem ... It is because struct irqaction's ... TP_PROTO just needs a forward declaration, ...
    (Linux-Kernel)
  • Re: interdependency and #include
    ... >> then you end up with a double declaration error I think. ... >> c) declares cb and ca template classes in the utils namespace scope ... >> c) tries to declare a class cb that ALREADY IS declared in A header file ... >> it says nothing about any dependancy between a.h and b.h in this case ...
    (alt.comp.lang.learn.c-cpp)

Loading