c-libraries

Use of macro overrides for functions

ε祈祈猫儿з 提交于 2020-06-28 06:10:10
问题 I was reading implementation of header in C library, where I came across macro overrides for functions, along with function declarations. I want to know how is this useful, .i.e. either macro should be used or functions, what is the need for override ? EDIT: Example: /* ctype.h standard header */ #ifndef _CTYPE #define _CTYPE /* Ctype code b i t s */ #define 0x200 /* extra alphabetic */ #define _XS 0x100 /* extra space */ #define _BB 0x80 /* BEL, BS, etc. */ #define _CN 0x40 /*CR, FF, HT, NL,

c -lz library link order (undefined reference to symbol “inflateInit2_”)

若如初见. 提交于 2020-01-30 02:45:34
问题 I link the the library in CodeBlocks in this order, -lz -L/usr/local/lib -L/usr/local/include -pthread -lswscale -lavutil -lavcodec -lmp3lame -lopus -ltiff -lvorbis -ltheora -ltheoraenc -ltheoradec -lvorbisenc -ltiffxx -llzma -lva -lavfilter -lavformat -lfreetype still got error: undefined reference to symbol "inflateInit2_" I am wondering whether it is the library link order problem? Where should I put the -lz? 回答1: For GCC and Clang (and probably e.g. the Intel compiler too) the rule is

Is there a performance degradation / penalty in using pure C library in C++ code?

人走茶凉 提交于 2019-11-30 13:43:13
问题 I saw this link but I'm not asking for a performance degradation for code using "extern". I mean without "extern", is there "context switching" when using C library in C++? Are there any problems when using pure C (not class-wrapped) functions in C++ application? 回答1: Both C and C++ are programming language specifications (written in English, see e.g. n1570 for the specification of C11) and do not speak about performance (but about behavior of the program, i.e. about semantics). However, you

Is there a performance degradation / penalty in using pure C library in C++ code?

a 夏天 提交于 2019-11-30 08:16:58
I saw this link but I'm not asking for a performance degradation for code using "extern". I mean without "extern", is there "context switching" when using C library in C++? Are there any problems when using pure C (not class-wrapped) functions in C++ application? Both C and C++ are programming language specifications (written in English, see e.g. n1570 for the specification of C11) and do not speak about performance (but about behavior of the program, i.e. about semantics ). However, you are likely to use a compiler such as GCC or Clang which don't bring any performance penalty, because it

Variant datatype library for C

爷,独闯天下 提交于 2019-11-30 06:02:44
问题 Is there a decent open-source C library for storing and manipulating dynamically-typed variables (a.k.a. variants)? I'm primarily interested in atomic values (int8, int16, int32, uint, strings, blobs, etc.), while JSON-style arrays and objects as well as custom objects would also be nice. A major case where such a library would be useful is in working with SQL databases. The most obvious feature of such a library would be a single type for all supported values, e.g.: struct Variant { enum

Variant datatype library for C

亡梦爱人 提交于 2019-11-28 13:34:05
Is there a decent open-source C library for storing and manipulating dynamically-typed variables (a.k.a. variants)? I'm primarily interested in atomic values (int8, int16, int32, uint, strings, blobs, etc.), while JSON-style arrays and objects as well as custom objects would also be nice. A major case where such a library would be useful is in working with SQL databases. The most obvious feature of such a library would be a single type for all supported values, e.g.: struct Variant { enum Type type; union { int8_t int8_; int16_t int16_; // ... }; }; Other features might include converting