antirez / sds

Simple Dynamic Strings library for C
BSD 2-Clause "Simplified" License
4.93k stars 480 forks source link

C90 Compliance #74

Open dagostinelli opened 7 years ago

dagostinelli commented 7 years ago

I'm trying to get another library (https://github.com/redis/hiredis) to compile with an app that is shooting for C89/C90 compliance. I'm running into problems. It uses sds.

The errors in sds that are preventing compilation are things like the following:

sds.h:48:10: warning: ISO C90 does not support flexible array members [-Wpedantic] char buf[];

sds.h:86:8: error: unknown type name ‘inline’ static inline size_t sdslen(const sds s) {

sds.c:640:52: warning: ISO C90 does not support ‘long long’ [-Wlong-long]

Is there any chance that sds (being a low level library) can be changed to become C90 compliant?

Related Issue: https://github.com/redis/hiredis/issues/494

ghost commented 7 years ago

No, because inline can not be written with the means of C language.

mcclure commented 6 years ago

Inline could be a #define when C90 is detected.