Pull requests

#1 Merged
jrsimmons jrsimmons
alfonse alfonse

Explicitly cast function pointers to avoid compiler warnings.

  1. Josh Simmons avatarJosh Simmons

Trying to kill off some unfriendly compiler warnings by explicitly casting the OpenGL function pointers. Maybe not the nicest way to go about it but works well enough.

This leaves a couple of warnings about casting between function pointer types but removes the vast majority.

Comments (3)

  1. Jason McKesson repo owner

    Under what circumstances are you getting these compiler warnings? I don't get them on MingW, Visual Studio, or even GCC on Linux. And that's with warnings cranked up.

  2. Josh Simmons author

    Default warning in GCC (4.7.1) and I think -Wall in clang both under linux.

    I couldn't even disable the damn warning in GCC, it's under -Wincompatible-pointer-types in clang.

    The implicit cast to function pointer does it pretty reliably I thought? Let me take another look.

  3. Josh Simmons author

    Yeah so this code: http://codepad.org/vqbv8a9P warns by default on GCC 4.7.1 (also impossible to disable) and Clang 3.1.

    test.c: In function 'main':
    test.c:17:11: warning: assignment from incompatible pointer type [enabled by default]
    test.c:17:11: warning: incompatible pointer types assigning to 'void (*)(int)' from 'fn_ptr' (aka 'void (*)(void)') [-Wincompatible-pointer-types]
    my_fn = get_blah();
          ^ ~~~~~~~~~~
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.