I was surprised to get a warning on passing in a 'const char*' into the str(n)cmp function. Turns out that a lot of the string.h functions do not have a const declaration in places I would expect them.
Is the absence of the const keyword on purpose or...?
If I look at other C-library documentation, there I see the const at the expected places...
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
[Z88dk-users] Use of const in clib
-
- Member
- Posts: 67
- Joined: Tue Dec 22, 2015 7:39 am
No, it's an oversight. Each time I go through the headers I find something that is not right. I'll make note to look at const for the next time through.I was surprised to get a warning on passing in a 'const char*' into the str(n)cmp function. Turns out that a lot of the string.h functions do not have a const declaration in places I would expect them.
Is the absence of the const keyword on purpose or...?
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
-
- Member
- Posts: 67
- Joined: Tue Dec 22, 2015 7:39 am
Did you forget one?Error at file 'C:\Users\marc\AppData\Local\Temp\zcc50387.asm' line 674: symbol '_strnlen_callee' not defined
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
OopsDid you forget one?Error at file 'C:\Users\marc\AppData\Local\Temp\zcc50387.asm' line 674: symbol '_strnlen_callee' not defined
; size_t strnlen_callee(const char *s, size_t maxlen)
SECTION code_clib
SECTION code_string
PUBLIC _strnlen_callee
EXTERN asm_strnlen
_strnlen: <------ **** should be _strnlen_callee
pop af
pop hl
pop bc
push af
jp asm_strnlen
This is file libsrc/_DEVELOPMENT/string/c/sdcc_iy/strnlen_callee.asm and libsrc/_DEVELOPMENT/string/c/sdcc_iy/strnlen_callee.asm .
I'll commit the fix now but if you don't want to download again you can just edit those yourself and rebuild the libraries. I'll commit a const fix to string.h too while I'm at it though I'm sure there must be missing const in other headers too.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
-
- Member
- Posts: 67
- Joined: Tue Dec 22, 2015 7:39 am
yep, that works
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot