Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2002:
[Freeciv-Dev] Re: newbie C question
Home

[Freeciv-Dev] Re: newbie C question

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Jules Bean <jules@xxxxxxxxxxxxxxx>
Cc: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>, <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: newbie C question
From: Ben Webb <ben@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 5 Mar 2002 12:35:36 +0000 (GMT)

On Tue, 5 Mar 2002, Jules Bean wrote:

> So if you use a C++ compiler to compile C code, then I think pointers
> get initialised to '0' (NULL).

Not if they're automatic variables... at least, not with gcc / g++ on the 
following testcase:

int main(void) {
  char *ptr;
  printf("ptr is %p\n", ptr);
  return 0;
}

        Move the char *ptr; outside of the function body, though, and 
it's a different story...

        Ben
-- 
ben@xxxxxxxxxxxxxxxxxxxxxx           http://bellatrix.pcl.ox.ac.uk/~ben/
"It is quite a three-pipe problem."
        - 'The Red-Headed League', Sir Arthur Conan Doyle




[Prev in Thread] Current Thread [Next in Thread]