printf icon indicating copy to clipboard operation
printf copied to clipboard

Make the library C89-compatible

Open lygstate opened this issue 1 year ago • 12 comments

For relative old but still usable OS such vxWorks 6.x, we want a cross-platform printf to handling printf things and use c89 syntax supported

lygstate avatar Dec 15 '23 09:12 lygstate

The library is currently written with C99 assumed. What would it take to make it compile as C89? Apart from the comment style change?

Also, do the C compiler on vxWorks 6.x really not support C99?

eyalroz avatar Dec 15 '23 17:12 eyalroz

The library is currently written with C99 assumed. What would it take to make it compile as C89? Apart from the comment style change?

Also, do the C compiler on vxWorks 6.x really not support C99?

its default option didn't support for double line comment

lygstate avatar Dec 15 '23 17:12 lygstate

its default option didn't support for double line comment

And with a non-default option?

Also, there are many other changes which would be necessary to make the library C89-compliant. Specifically, we would need to not use long long and avoid mixing declarations and code. How come the vxWorks compiler accepts it then?

eyalroz avatar Dec 15 '23 18:12 eyalroz

its default option didn't support for double line comment

And with a non-default option?

Also, there are many other changes which would be necessary to make the library C89-compliant. Specifically, we would need to not use long long and avoid mixing declarations and code. How come the vxWorks compiler accepts it then?

Currently only use block line comment is enough. long long is supported

lygstate avatar Dec 15 '23 18:12 lygstate

The header is present, it's just the header with -ansi option

lygstate avatar Dec 15 '23 18:12 lygstate

Currently only use block line comment is enough. long long is supported

So, what you're asking is not C89 support, nor C90 support. Perhaps we can accommodate your compiler by some kind of CMakeLists.txt check, that would add an appropriate flag for // comment support?

eyalroz avatar Dec 15 '23 18:12 eyalroz

Currently only use block line comment is enough. long long is supported

So, what you're asking is not C89 support, nor C90 support. Perhaps we can accommodate your compiler by some kind of CMakeLists.txt check, that would add an appropriate flag for // comment support?

Yeap, it's a -ansi option. I've seen a lot more compiling warning, I think achieve that would receive broader usage

lygstate avatar Dec 15 '23 18:12 lygstate

Yeap, it's a -ansi option

I think you've misread what I've written. The -ansi option, at least with compilers such as clang and gcc, does not add support for anything; it is essentially equivalent to -std=c90, which contradicts std=c99, and restricts rather than relaxing constraints.

At any rate, it remains unclear to me what you are asking and for purpose.

eyalroz avatar Dec 17 '23 16:12 eyalroz

Yeap, it's a -ansi option

I think you've misread what I've written. The -ansi option, at least with compilers such as clang and gcc, does not add support for anything; it is essentially equivalent to -std=c90, which contradicts std=c99, and restricts rather than relaxing constraints.

At any rate, it remains unclear to me what you are asking and for purpose.

I am trying to use it within very old system such as VxWorks( and change the compiler option is not accepted) That's why I am trying to do c89 compat(Not allow //) comment

lygstate avatar Jul 03 '24 10:07 lygstate

I would consider a pull request which adds C89 support, if significant changes are #ifdef'ed ...

eyalroz avatar Jul 03 '24 19:07 eyalroz

There are other C90 limitations that the PR does not address.

eyalroz avatar Jul 19 '24 11:07 eyalroz

There are other C90 limitations that the PR does not address.

Yeap, if change all would be a large , thank you for working on this, I am busy on other things

lygstate avatar Jul 19 '24 18:07 lygstate