Ticket #213 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

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

Changed 3 years ago by pramsey

  • owner changed from geos-devel@… to sgillies
  • version set to 3.0.0
  • milestone set to 3.1.0

Changed 3 years ago by pramsey

  • milestone changed from 3.1.0 to 3.2.0

Changed 3 years ago by mloskot

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?

Changed 3 years ago by slinkp

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.

Changed 3 years ago by strk

Sounds sane to always include. Committed to r2492.

Changed 3 years ago by strk

  • status changed from new to closed
  • resolution set to fixed

Changed 3 years ago by mloskot

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?

Changed 3 years ago by strk

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

Changed 3 years ago by mloskot

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

Changed 3 years ago by strk

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

Changed 3 years ago by mloskot

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

Note: See TracTickets for help on using tickets.