Opened 16 years ago

Closed 9 years ago

#2402 closed defect (fixed)

Alternative to casting everything in r14607

Reported by: hobu Owned by: hobu
Priority: normal Milestone:
Component: SWIG (all bindings) Version: unspecified
Severity: normal Keywords:
Cc: tamas, Ari Jolma

Description

Frank,

Here's a patch I came up with against source:/trunk/gdal/swig/include/ogr.i@14600 that seems to cure the compiling errors in the java bindings when building -DDEBUG. Do you think this is appropriate (sorry to attempt to undo your tedium, but I'd really like to avoid having casts all over the place in the swig interface code if we can avoid it)?

Attachments (1)

javapatch.patch (2.1 KB ) - added by hobu 16 years ago.

Download all attachments as: .zip

Change History (9)

by hobu, 16 years ago

Attachment: javapatch.patch added

comment:1 by Even Rouault, 16 years ago

Why not defining 'typedef struct OGRSpatialReferenceHS OSRSpatialReferenceShadow' and so on, even on non DEBUG builds ? It should work too, shoudln't it ? And it would save the conditionnal compilation.

comment:2 by hobu, 16 years ago

Cc: tamas Ari Jolma added
Component: JavaBindingsSWIG (all bindings)
Owner: changed from aaime to hobu

I would support that. Adding Tamas and Ari in case they have anything to add.

comment:3 by warmerdam, 16 years ago

Howard,

The change looks fine to me. Go ahead and apply it.

comment:4 by hobu, 16 years ago

Status: newassigned

Ok, osr.i and ogr.i were updated in r14634. Now the question is whether or not these should be structs for the more rigorous type safety all of the time instead of just -DDEBUG. Ari and Tamas?

comment:5 by Ari Jolma, 16 years ago

There are invalid conversion errors in CreateGeometryFromWkb, CreateGeometryFromWkt, and BuildPolygonFromEdges, when compiling with these typedef structs. Otherwise ok. I'm for more rigorous type safety, but not very strongly.

in reply to:  4 comment:6 by tamas, 16 years ago

Replying to hobu:

Ok, osr.i and ogr.i were updated in r14634. Now the question is whether or not these should be structs for the more rigorous type safety all of the time instead of just -DDEBUG. Ari and Tamas?

I would support applying this to the nondebug configuration as well. I`m not totally sure about the possible issues may be triggered, but we can revert the changes if serious problems are happening. C# can currently compile with -DDEBUG setting.

I cannot imagine who use the DEBUG switch in practice, but shouldn`t we add this setting to the compiler command line if the DEBUG option is specified in the makefile? Or is everyone use EXTRAFLAGS=-DDEBUG for this purpose?

Tamas

comment:7 by Jukka Rahkonen, 9 years ago

If I understand right, the issue was in "compiling errors in the java bindings when building -DDEBUG."

Have such errors occurred all these 7 years or can this ticket be closed as fixed?

comment:8 by Ari Jolma, 9 years ago

Resolution: fixed
Status: assignedclosed

The original problem was fixed by Hobu but Even's suggestion (which to me seems to be a much bigger issue since the type safety stuff concerned is not just in Swig but also in OGR.

I'm closing this.

Note: See TracTickets for help on using tickets.