Search code examples
cc99c89

php extension code must be c89 style


I wrote a php extension: https://github.com/binpack/binpack-php, it works great and I want to submit this extension to PECL.

But they said that my code is C99 style and PHP except C89 style. I read somethings about C99 and C89.

And figure out some difference:

  • stdbool.h
  • inline vs __inline__

I think there are some problem in these 2 files:

I modified some of my code and used -std=gnu89 to test them. But I am not sure if there are still some problems.

My question is:

  • How can I test if my code is c89 style?
  • If anyone can point out the problems in my code, that will be great.

Solution

  • It won't warn about every feature not in C89, but

    gcc -Wall -pedantic -std=c89 ...
    

    is a good place to start.