Hello,

I just discovered that OpenSC casts the value return by calloc() and malloc().

For example in ./libopensc/reader-pcsc.c line 767
        reader_buf = (char *) malloc(sizeof(char) * reader_buf_size);

According to [1] "When using C, this is considered bad practice; it is
redundant under the C standard. Moreover, putting in a cast may mask
failure to include the header stdlib.h, in which the prototype for
malloc is found."

I know casting malloc() and calloc() is mandatory in C++ but OpenSC is
not C++ code.

Any objection to the removal of these "bad" casts?

Bye

[1] http://en.wikipedia.org/wiki/Malloc#Casting_and_type_safety

-- 
 Dr. Ludovic Rousseau
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to