Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
which warnings ? i don't see any when i run the the Solution panel against the tests without those lines
also, the number of bytes in the array is
length * sizeof *expected
, notsizeof(char)
. (orlength * sizeof(unsigned)
, but I prefer avoiding hardcoding). the memory size of an array is its length multiplied by the size of its element type.what's the purpose of these lines ?
should have been raised as an issue. no UB here, just a mistake on my part, an
==
that should have been a!=
during comparison when either of the words was a null pointer. fixed.index
logic is not needed anymorecr_assert_arr_eq()
is the size in bytes of the array, not its length (as it callsmemcmp()
behind the scenes)i added this fixed test to C.
cr_assert_arr_eq()
yes, the root author gets credited
added
approved
read the assertion message, not the line of code:
can be just
or even
this line could be made more readable by using character literals such as
'a'
and'0'
. or just set the buffer size to e.g.128
and use direct indexing; this is nowhere close to a noticeable memory footprintthat does not account for the nul terminator, hence the crash.
also, please don't golf the Solution panel, it has to be maintainable; same remark for things like
approved
this cast has no effect.
array
is already an array ofint
, so whatever you store inside is going to be implicitely cast to anint
.approved.
Loading more items...