Skip to content

CLN: explicitly cast (void *) -> (char *) - #4524

Merged
efiring merged 1 commit into
matplotlib:masterfrom
tacaswell:cln_fixup_cntr_pointers
Jun 14, 2015
Merged

efiring merged 1 commit into
matplotlib:masterfrom
tacaswell:cln_fixup_cntr_pointers

Conversation

@tacaswell

Copy link
Copy Markdown
Member

When pulling data from from PyArrray_DATA explicitly cast
to (char *).

Addresses issues raised in #4518

@frenchwr does this address the issues of using icpc for everything? I was inspried by the `-fp-model strict' which I (maybe wrongly) translated to 'pointer model' given that the exception is about mis-matched pointer types.

When pulling data from from PyArrray_DATA explicitly cast
to (char *).

Addresses issues raised in matplotlib#4518
@tacaswell

Copy link
Copy Markdown
Member Author

@efiring @jkseppan blame says the two of you have worked on this bit of code before.

@tacaswell
tacaswell force-pushed the cln_fixup_cntr_pointers branch from 78f8317 to e0da0b1 Compare June 14, 2015 20:41
@jkseppan

Copy link
Copy Markdown
Member

Looks correct to me.

@efiring

efiring commented Jun 14, 2015

Copy link
Copy Markdown
Member

As far as I understand C, there is nothing "unclean" about the existing version here; but the explicit casts don't hurt anything. (In my understanding, the point of having a void pointer is that explicit casts are not needed. Otherwise, to be consistent, you would also need to use a cast with every assignment of NULL.)
This seems like the wrong solution to the original problem, however, which is that there is a chunk of C++ marooned in a C source file (in qhull). Running everything through a C++ compiler seems like an odd hack.

@jkseppan

Copy link
Copy Markdown
Member

I was wondering why the NULL doesn't need a cast, but I guess that expands to nullptr and is handled specially in C++.

@efiring

efiring commented Jun 14, 2015

Copy link
Copy Markdown
Member

Must be; but the basic point is that this is C code, not C++. And as C code, it doesn't need the explicit casts.

@jkseppan

Copy link
Copy Markdown
Member

I agree that the casts are unnecessary when compiling as C, but if this file is otherwise valid as C++ I don't see the harm in adding the casts. I also agree that the proper fix is to make qhull valid C.

@frenchwr

Copy link
Copy Markdown

Yep, this did the trick! Is there a way to force the use of icpc in the build config? Otherwise I think the default build will fail, which includes installs from package managers like pip.

CC=icpc python setup.py install

@efiring

efiring commented Jun 14, 2015

Copy link
Copy Markdown
Member

Given that this change does no harm, I will merge it. But I also merged #4519, so it shouldn't be necessary unless someone really wants to force the compiler to be icpc.

@tacaswell

Copy link
Copy Markdown
Member Author

@efiring Ah, learned something about C, I have mostly worked in C++.

@frenchwr The 'easy' cop out there is to install all the dependencies first.

So, it seems we have two ugly but functional solutions (this and #4519 ).

efiring added a commit that referenced this pull request Jun 14, 2015
CLN: explicitly cast (void *) -> (char *)
@efiring
efiring merged commit 62bef78 into matplotlib:master Jun 14, 2015
@tacaswell
tacaswell deleted the cln_fixup_cntr_pointers branch June 14, 2015 21:33
@QuLogic

QuLogic commented Jun 16, 2015

Copy link
Copy Markdown
Member

the `-fp-model strict' which I (maybe wrongly) translated to 'pointer model'

FYI, this refers to the floating point model (strict IEEE754, denormal handling, etc.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants