Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#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 pramsey, 15 years ago

Milestone: 3.1.0
Owner: changed from geos-devel@… to sgillies
Version: 3.0.0

comment:2 by pramsey, 15 years ago

Milestone: 3.1.03.2.0

comment:3 by mloskot, 15 years ago

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?

comment:4 by slinkp, 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:5 by strk, 15 years ago

Sounds sane to always include. Committed to r2492.

comment:6 by strk, 15 years ago

Resolution: fixed
Status: newclosed

comment:7 by mloskot, 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:8 by strk, 15 years ago

... including always stddef.h is, to get that definition.

comment:9 by mloskot, 15 years ago

First, you objected inclusion of <stddef.h>, then you confirmed it's necessary. Confusing, isn't it?

comment:10 by strk, 15 years ago

could be a translation problem, I said "Sounds sane to always include".

comment:11 by mloskot, 15 years ago

It is, indeed. I shouldn't read & reply it hurry. Sorry my fault.

Note: See TracTickets for help on using tickets.