wchar_t is useless2234 (11/21/2011 2:14:35 PM) comp.lang.c I have recently written a number of posts regarding C's wide character support. It now turns out that my investigation has been in vain: wchar_t is useless in portable C programming, although I'm not quite sure... Lauri
No fread and fwrite for wide characters?1039 (11/10/2011 5:26:07 PM) comp.lang.c It seems that the standard I/O operations for wide characters are conspicuously lacking functions that read or write an array of arbitrary wide characters into a stream. E.g. for writing, there's only fputws, w... Lauri
Encoding of character literals435 (11/3/2011 8:41:08 PM) comp.lang.c Hello. I find C99's language on internationalization features particularly hard to decipher, so I'd appreciate some clarifications. I'm particularly interested in the relationship of the execution character s... Lauri
int_leastN_t is all we need?1623 (9/8/2011 2:12:14 AM) comp.lang.c I have been considering C's various integer types for a while, and I'm having trouble seeing if they are all really justified. In general, the most important thing when selecting an integer type is to choose o... Lauri
Mixed initializer for char arrays?2730 (7/1/2011 11:28:56 AM) comp.lang.c There are two ways to initialize a char array: with integer expressions or with a string literal: char foo[3] = { 102, 111, 111 }; char bar[4] = "bar"; However, I'd like to initialize the array so that its fi... Lauri
Converting between object pointers1920 (6/29/2011 10:48:27 AM) comp.lang.c The standard (6.3.2.3#7) makes conversion between object types well-defined when a converted pointer is "correctly aligned" for the referenced type. But in what situations can a portable program trust that a po... Lauri
snprintf without null-termination?1229 (6/22/2011 10:45:13 AM) comp.lang.c I would like to format some output into a buffer that is exactly of the correct size to hold the formatted output _without_ a terminating NUL. However, the snprintf function always ensures that the resulting st... Lauri
Struct wrapper conversion422 (6/16/2011 8:50:41 AM) comp.lang.c Given: typedef struct { int foo; } Bar; The following is legal (N869 6.7.2.1#12): Bar b = { 42 }; int* ip = &bar.foo; Bar* bp = (Bar*) ip; assert(bp->foo == 42); But this, to my understanding, might not be:... Lauri
Is char obsolete?2349 (4/8/2011 1:06:08 PM) comp.lang.c I'm beginning to wonder if I should use the char type at all any more. An abstract textual character is nowadays a very complex concept. Perhaps it is best represented as a Unicode code point, perhaps as somet... Lauri
Compound literal without initializer?423 (2/16/2011 12:08:04 AM) comp.lang.c Hello. I'd like to have a macro NEW(t) that expands to an expression whose value is a pointer to a newly allocated object of type t that has automatic storage duration (when used inside a function). If an expl... Lauri
Why don't C comments nest? #28427 (11/11/2011 7:21:06 PM) comp.lang.c Hi all, (Apologies if this is in a FAQ somewhere, I couldn't find anything). Almost every time I do any significant amount of coding in C or C++, I end up wishing C-style comments would nest. It would make ra... atp1(2)
Customizing printf2432 (11/15/2011 1:36:09 PM) comp.lang.c Recently I was wondering how to extend lcc-win's printf to support 128 bit integers, and searching the net I found this: http://www.gnu.org/s/hello/manual/libc/Customizing-Printf.html Apparently gcc has an i... jacob31(869)
wchar_t is useless2234 (11/21/2011 2:14:35 PM) comp.lang.c I have recently written a number of posts regarding C's wide character support. It now turns out that my investigation has been in vain: wchar_t is useless in portable C programming, although I'm not quite sure... la(473)
Still no dirent.h in C1X4434 (11/24/2011 12:43:26 PM) comp.lang.c Hello, I've seen the new standard of C called C1x. http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1250.pdf They added some great features like anonymous unions and threads. But there is still no directory m... demelier.david(1)
Shifting bits #23529 (11/29/2011 5:02:45 AM) comp.lang.c Here is another C interview question, what this C program does. I see it compiles fine in strict ANSI standard. H&S5 section 2.7.5 says x is an escape character for hexadecimal notation. Section 7.6.3 says ... sunrise2(598)
Sidestepping undefined behavior1828 (12/3/2011 10:48:17 PM) comp.lang.c Hello. Consider this code. float baz(float f) { if(sizeof(float) ^ sizeof(int)){ /* use slow ordinary FP operations */ }else{ int i = *(int *)&f; /* do clever bit-twiddling to implement FP operation *... nospam21(11322)
Precision upto n decimal points1131 (12/4/2011 10:57:37 AM) comp.lang.c I am writing power series expansion programs. For eg. e^x = 1 + x + x^2/2! + x^3/3! + ..... Depending on how much precision I need, how do I stop the expansion. For eg. if I need up to precision 5 then my lo... pp1548(1)
Struct casting1630 (12/5/2011 9:52:13 PM) comp.lang.c This was pulled up at a code review. Code was similar to this: struct foo { int bar; int baz; } f; int * i = (int *) f; The only way this could go wrong is if the struct contains padding before its firs... edward.p.rutherford79(45)
regarding free function in c library #22128 (12/17/2011 10:20:16 PM) comp.lang.c Hi Everyone, It is known that function free() of c library expects parameter of type void* and when we invoke them with pointers to any type, compiler automatically performs the typecast, can anyone let me k... pc8875(5)