From http://en.wikipedia.org/wiki/Malloc#Casting_and_type_safety " Casting and type safety malloc returns a void pointer (void *), which indicates that it is a pointer to a region of unknown data type. One may "cast" (see type conversion) this pointer to a specific type, as in int *ptr = (int*)malloc(10 * sizeof (int)); 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. In the absence of a prototype for malloc, the C compiler will assume that malloc returns an int, and will issue a warning in a context such as the above, provided the error is not masked by a cast. On certain architectures and data models (such as LP64 on 64 bit systems, where long and pointers are 64 bit and int is 32 bit), this error can actually result in undefined behavior, as the implicitly declared malloc returns a 32 bit value whereas the actually defined function returns a 64 bit value. Depending on calling conventions and memory layout, this may result in stack smashing. The returned pointer need not be explicitly cast to a more specific pointer type, since ANSI C defines an implicit conversion between the void pointer type and other pointers to objects. An explicit cast of malloc's return value is sometimes performed because malloc originally returned a char *, but this cast is unnecessary in standard C code.[4][5] Omitting the cast, however, creates an incompatibility with C++, which does require it. The lack of a specific pointer type returned from malloc is type-unsafe behaviour: malloc allocates based on byte count but not on type. This distinguishes it from the C++ new operator that returns a pointer whose type relies on the operand. (see C Type Safety). " See also http://www.opensc-project.org/pipermail/opensc-devel/2010-August/014586.html git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4636 c6295689-39f2-0310-b995-f0e70906c6a9 |
||
---|---|---|
doc | ||
etc | ||
m4 | ||
solaris | ||
src | ||
win32 | ||
COPYING | ||
Makefile.am | ||
Makefile.mak | ||
NEWS | ||
README | ||
bootstrap | ||
configure.ac | ||
svnignore |
README
OpenSC documentation is now maintained in our online wiki at http://www.opensc-project.org/opensc/ and a copy in html format is provided in the doc/ directory with all releases or snapshots of OpenSC in tar.gz files. Please take a look at the documentation before trying to install OpenSC. Most important are the pages OverView A short introduction what OpenSC is and how it fits into the big picture. WhatsNew What is new, what has changed since the last major release? Also see this section for a list of incompatibilities. Short list: libopensc is now version 2.0.0, i.e. you need to recompile applications using opensc. And all libraries and the opensc-pkcs11.so module moved from lib/pkcs11/ or lib/opensc/ to simply lib/. That fixes a number of problems, but you might need to change some configuration. OperatingSystems What your operating system needs to have for OpenSC to work. CompilingInstalling How to compile and install OpenSC yourself. QuickStart installation and basic steps to initialize a blank smart card. UsingOpensc options when using OpenSC. Also check the specific pages of the smart cards or crypto tokens you want to use. If you have any trouble the MailingLists page will tell you how to contact us for help. Regards, the OpenSC Team.