#213 closed defect (fixed)
geos_c.h should always include stddef.h
| Reported by: | slinkp | Owned by: | sgillies |
|---|---|---|---|
| Priority: | major | Milestone: | 3.2.0 |
| Component: | Default | Version: | 3.0.0 |
| Severity: | Unassigned | Keywords: | |
| Cc: |
Description
geos_c.h contains these lines:
#ifndef __cplusplus # include <stddef.h> /* for size_t definition */ #endif
I don't know squat about C++, but I'm told by a coworker that the conditional is wrong. It usually happens to work because we have probably already included stddef.h from elsewhere. It should really just be:
# include <stddef.h> /* for size_t definition */
We discovered this while trying to use the h2xml.py script from ctypeslib on geos_c.h... that script in turn uses gccxml. After making the above change, it works.
Change History (11)
comment:1 by , 16 years ago
| Milestone: | → 3.1.0 |
|---|---|
| Owner: | changed from to |
| Version: | → 3.0.0 |
comment:2 by , 16 years ago
| Milestone: | 3.1.0 → 3.2.0 |
|---|
comment:3 by , 16 years ago
comment:4 by , 15 years ago
yes, we built successfully with the proposed change on a gentoo linux box. I no longer have that box though, so I don't know what version of gcc / g++ was on it.
comment:6 by , 15 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:7 by , 15 years ago
strk,
What's sane in it? Does geos_c.h use size_t? It does. So, where definition of this type is supposed to come from?
comment:9 by , 15 years ago
First, you objected inclusion of <stddef.h>, then you confirmed it's necessary. Confusing, isn't it?
comment:10 by , 15 years ago
could be a translation problem, I said "Sounds sane to always include".

The header is supposed to be C and C++ compatible header file, so including <stddef.h> is prerfectly correct, but including <cstddef> would be not.
Does the It should really just be: #include <stddef.h> mean that you have fixed it this way and you have built geos with success? Could you give more details about what platform/compiler you use?