-
Notifications
You must be signed in to change notification settings - Fork 1.3k
UA_String, signedness of UA_Byte and char #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hmm. Good point. |
It seems to be compiler or even machine-dependend... using |
IEC62541 defines Byte as 8bit, unsigned and a ByteString as an array of Bytes. Therefore I decided a while ago that this should be an unsigned char despite the fact that most c-library functions have char arguments and need a cast anyways. |
Yea, but you are okay with changing the default signess of char in gcc?
|
The default signedness of char is undefined. |
do you mean to over-define it in headers? |
Can it be done with headers only? The easy way out would be to replace
|
I'd opt for keeping UA_Byte as uint8. I can live with a handfull of strange casts -- which are perfectly documented with this thread ;-) |
I opt in for keeping UA_Byte as uint8_t and to go for a well-documented compiler flag - to half the number of casts.
|
👍 |
@Stasik0 👍 |
The base64 code breaks with -funsigned-char. :-( |
Damn, I'd assume that we will habe similar problems with crypto libraries... What do we do? Just nothing?
|
Crypto will not be problematic as long as it is compiled with their own makefiles. How about this? |
I am currently not in aachen, so i can look into it only on weekend. Let it as is and let me some time until saturday, okay? The outer api of base64 as used in tests will not change...
|
ok, sure. |
@jpfr taking ffmpeg will force us to give up static linking exception :/ I fixed the problematic code in base64 and it seems to work, however declaring strings like |
Hmm. There's some funny stuff in the spec. -funsigned-char does not relate to pointers. Works with an additional flag. Is this still ok? |
Oh hey. It works with just |
okay fine for me as it is |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hey folks,
in 9f7daee I pushed a small API for base64 handling that was taken from public domain (it is a bit hackly included, however the actual implementation if fully hidden). The 3rd party functions require
char*
as in and output. However we require everything in string and data to beUA_Byte*
. The problem is thatUA_Byte
is explicitly unsigned whilechar
's signess is undefined. Together with our current warning combinations it results in following codelines:or
which is IMHO a bit painful.
So thinking of integration of 3rd party applications with our stuff, I have following questions:
UA_Byte
to be explicitly unsigned? It seems not to make any difference, since(void*)(char*)
casts workUA_Byte
to be compatible with the 3rd party generic datatypechar
? UA_Byte vs. UA_SByte?-Sten
The text was updated successfully, but these errors were encountered: