comp.lang.c http://groups-beta.google.com/group/comp.lang.c
Today's most active topics: * noop comparator for qsort - 15 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/38fc202bbe7f8457 * Learning C from old books ?? - 13 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/187ec3296ad0ead9 * getting variable type in C - 8 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3c5bebf4c0625e0b * C pre Processor - 8 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/12f5bbcaf46968a * Just need a few questions answered... - 7 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2674fd23fe6c4327 Active Topics ============= noop comparator for qsort - 15 new ---------------------------------- The fourth argument is a comparator that returns `an integer less than, equal to, or greater than zero' depending on the ordering of its arguments. If I don't care about the order and simply want qsort() to run as quickly as possible, how should the comparator be defined? If qsort were stable, the following would be best: int compare (void *x, void *y) { return 0; ... ...is this still true for a possibly non-stable qsort()? -trent ... - Sun, Nov 14 2004 12:15 am 15 messages, 9 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/38fc202bbe7f8457 Get array size by a pointer dynamically - 4 new ---------------------------------- Hi, Could anyone tell me how to determine the size of array of characters dynamically? For example, ... char *b[]={"orange","apple"}; void main() { char **p=a; ... I want to get array size of "a" which is 3 by "p". How? Thanks! ... - Sun, Nov 14 2004 12:20 am 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/966fa4ec6ef0ce84 nonzero != 1, right? - 6 new ---------------------------------- "pete" wrote ... Consider a 16-bit twos complement machine. The argument is the same for 32 bits, but it is less typing. INT_MAX = 0x7FFF; y = -1. x = y = 0x7FFF + 1 = 0x8000 = INT_MIN = non-zero, so we are OK. A more interesting case is when one or both are INT_MIN. INT_MIN is 0x8000 1s compelent INT_MIN is 0x7FFF 2s complement INT_MIN is 0x8000 ie -INT_MIN = INT_MIN ! however if x is not INT_MIN, x + 0x8000 is still non-zero, and INT_MAX is one less than - INT_MIN. However if x = INT_MIN... - Sun, Nov 14 2004 12:38 am 6 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/26814eeabc379360 getting variable type in C - 8 new ---------------------------------- ... In C++ : * http://groups.google.com/groups?selm=apdgnn%24i5dh%241%40ID- 79865.news.dfncis.de * http://alexvn.freeservers.com/s1/download.html ( Recognition of simple variables, pointers and arrays) ... - Sun, Nov 14 2004 1:03 am 8 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3c5bebf4c0625e0b Problem with big matrices - 5 new ---------------------------------- Hi! I have problems with memory allocation of matrices bigger than 4 Mb. So, here is the example: ... /* Compile with: gcc -Wall -O3 crash.c -o crash */ int main(){ int i,j; double A[M][N]; for (i=0; i<M; i++) for (j=0; j< N; j++) A[i][j] = (double)i+j; return EXIT_SUCCESS; ... In the command line: [EMAIL PROTECTED] r4]$ gcc -Wall -O3 crash.c -o crash [EMAIL PROTECTED] r4] $ ./crash Segmentation fault [EMAIL PROTECTED] r4]$ My PC has 512 Mb RAM and this matrix has only 16 Mb. How can I allocate this matrix? Thanks a lot in advance!... - Sun, Nov 14 2004 1:08 am 5 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/65ee77fb13e3226a Modify Static Data Okay? - 5 new ---------------------------------- [snip] ... I always considered string literals as constant objects. Why are they considered non-const if they can not be modified? Is it because they're stored in a different area of memory than const objects? ... - Sun, Nov 14 2004 1:20 am 5 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/38a3bbbb875bc9ac derangement: coding review request - 2 new ---------------------------------- On Sun, 14 Nov 2004 00:31:33 GMT, in comp.lang.c , pete ... In my book, thats a bug. Inconsistency and documentation failures are just as much bugs as coding errors. ... Since its where the compiler looks, its the most important place ! And often its the only place, other than the printed manual. Think " library function". ... - Sun, Nov 14 2004 1:54 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/63c5271ccb9149a Stuck with a strange core (C code) -- Please help. - all new ---------------------------------- Hello SZ, one thing first: Please do not top-post. ... Okay, so this really speaks of stack corruption or some other flavour of pointer trouble. . .. Note: Many people who post code look-alikes leave out the critical parts so the original code is really necessary if you cannot break it down to a minimal example. ... Is the place in the parameter lists where you pass unacked_cb or the address of unacked_cb->time const qualified? Otherwise I would say try it. Your compiler may tell you interesting things about it.... - Sun, Nov 14 2004 2:13 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/40901c21e3f7e563 Compiler warning level - 5 new ---------------------------------- On Sat, 13 Nov 2004 23:19:36 +0100, Michael Mair ... I can believe that, I've had to tell it (OK, lclint but they are from the same base) a number of things to ignore. Like its insistance that %X wants an unsigned int (almost all of the time I'm using %X is in %debug code, where I want the hex value, I don't give a monkey's %whether it's signed or not). ... Things like comparing an int with a character constant? When the int has to be that to contain EOF? That's just silly (in fact I can't recall any case of comparing an int with a.. . - Sun, Nov 14 2004 5:02 am 5 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d7360ceb0613160 What does "void (*vector[])( )" means? - 3 new ---------------------------------- ... This is an array of functions each with no (undefined) argument list that return void. It can be made easier to understand ysing a typdef for the function ... - Sun, Nov 14 2004 8:22 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/848452dc513d5704 C pre Processor - 8 new ---------------------------------- hi all, Ive to make a C pre processor for my semester project. Can anybody please tell me the functions which are performed by the c pre processor? Well, is it true that one of the funcitons performed by the CPP is to include the source code of the included header file in the original source code file.eg include the source code of stdio.h if this file is used in the .c file. Thanks in advance Candy ... - Sun, Nov 14 2004 9:22 am 8 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/12f5bbcaf46968a Arraym malloc() and free() question - 2 new ---------------------------------- ... It most certainly does not. It says "a header"; to refer only to the header that would have provided a declaration for the function, it would have used the definite article. The second paragraph of 7.1.7 is misworded. That's all there is to it. ... - Sun, Nov 14 2004 10:53 am 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/6c0e0b0f81ee43bf test - all new ---------------------------------- ... - Sun, Nov 14 2004 12:14 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a0b1288c9a064ba9 Learning C from old books ?? - 13 new ---------------------------------- Hi,all,I was just wondering if I am likly to have any problems trying to learn C from older books,I have some from the late 80`s,mid/late 90`s. I am using Dev-C++ on the pc windows platform,But I have noticed small differnces in the books such as,int main(),main(void),fprintf,and others,just wondering if these older books are still worth trying to learn from as Im on a very tight budget and can`t really afford any thing else,or are they just going to be to outdated. I would ultimately like to learn C then... - Sun, Nov 14 2004 12:15 pm 13 messages, 10 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/187ec3296ad0ead9 Obfuscate C tricks - 2 new ---------------------------------- ... Both of these are more obfuscated than: a = (a == b); PS. When posting in comp.lang.c please write your comments AFTER the ones you're replying to. .. . - Sun, Nov 14 2004 12:58 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/20eafe92fac9409c Golf Competitions - all new ---------------------------------- On Fri, 12 Nov 2004 11:34:12 -0600, Merrill & Michele ... Questionmaster? Chris C ... - Sun, Nov 14 2004 1:07 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/55b43d0bd0d44eb ANN: xcpp C preprocessor now available - 2 new ---------------------------------- xcpp is a rewrite from scratch of the scpp and other preprocessors (I haven't found one that compiles and works, so I wrote my own). It is designed to remove redundant conditional compilation, and replace known defined symbols, while leaving anything it doesn't know about intact (whereas the ordinary C preprocessor will remove everything). I've written it using only standard C, as far as I can tell it should "compile anywhere". I would be very interested in reports of it passing or failing under non-gcc compilers (the only... - Sun, Nov 14 2004 12:47 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/7302d526ed70110a Value of uninitialized char - 2 new ---------------------------------- What's value of uninitialized char declared outside of any function ? cheers . .. - Sun, Nov 14 2004 1:46 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2747210e72381d9b has anyone followed sedgewick's "algorithms in c parts 1-4"? - 2 new ---------------------------------- ben wrote: ... The code is available online & I used it years ago. Look. gtoomey ... - Sun, Nov 14 2004 3:01 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/33d33976ce524504 OT: Welcome back Mr Kirby - all new ---------------------------------- Welcome back to the ng. ... - Sun, Nov 14 2004 3:17 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c252fbe59cd39db0 homework problem - all new ---------------------------------- ... The OP has the same email address as "Merrill & Michele", if that helps. .. . - Sun, Nov 14 2004 4:19 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a6d5cc60dffdcbfd Just need a few questions answered... - 7 new ---------------------------------- Code: ... { int in; ... scanf("%d \n", &in); printf("You entered % d, the regular value is %c", in, in); getchar(); getchar(); getchar(); getchar(); return 0; ... This program is supposed to convert an ascii number value to its regular equivalent. Example: entering 90 will give you a Z. Why then do I need to type in 90 twice? Also, why do I need to have so many "getchar()"'s at the end of the code to prevent the window from closing right away? Thanks! -=Allen=- ... - Sun, Nov 14 2004 4:48 pm 7 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2674fd23fe6c4327 How to pass variable argument list to another function w/ variable argument list? - 2 new ---------------------------------- I'd like to write a wrapper function "mysprintf(char *buffer, char *format, ... )" which calls sprintf(). My question is how can I pass variable argument in mysprintf() to sprintf(). Thanks in advance... Ben ... - Sun, Nov 14 2004 5:31 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4496b57695ceef8a Write a customized printf function in C - 3 new ---------------------------------- During an interview, I am asked to answer a question: Printf is a major formatted output function provided by the standard C library. Printf accepts a formatting string followed by a various number of arguments to replace formatting specifiers in the formatting string. You should implement the subset of the printf function compliant to the following specification. void printf (const char* format, ...); The format can contain the following format specifiers: format specifier := %[flags][width][. precision][modifier]type... - Sun, Nov 14 2004 7:47 pm 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/95e1d13f0e4e7417 OT: Cheney's heart acting up-TO MUSTAPHA - 2 new ---------------------------------- On Sun, 14 Nov 2004 19:17:13 -0800, "Big Mikey" ... First we start: ... Then we have: ... Another reason that Big Mikey is the brain trust of wherever he lives in California. ... ... - Sun, Nov 14 2004 7:53 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c0a762e62a4b2ce8 Could someone swing by the Lakes? - all new ---------------------------------- On Mon, 15 Nov 2004 03:26:49 GMT, "CyßerHoG®" ... I agree. ... - Sun, Nov 14 2004 7:54 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d9b3855a6114bb60 Welcome to comp.lang.c! - all new ---------------------------------- Welcome to comp.lang.c! This post is intended to give the new reader an introduction to reading and posting in this newsgroup. We respectfully request that you read all the way through this post, as it helps make for a more pleasant and useful group for everyone. If you are new to newsgroups in general, you can learn a lot about how to get the most out of newsgroups by reading the links below: ... With that said, please keep in mind that comp. lang.c is a group for discussion of general issues of the C programming language, as defined... - Sun, Nov 14 2004 7:54 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/db1b3814dfb3eb44 Crazy stuff - all new ---------------------------------- On Sun, 7 Nov 2004 05:58:35 +0000 (UTC), [EMAIL PROTECTED] ... < snip: modification, namely strtok'enizing, of string literal value vs array initialized to contain string> FAQ 1.32, 16.6 at the usual places and ... Huh? Unless I completely misunderstand what you are saying: while the C standard does not specify implementation techniques, and so can't topically rely on "the stack", on every machine I know of that has a "processor stack segment", or indeed just a "processor (memory) stack" anywhere, it was designed to... - Sun, Nov 14 2004 8:09 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3bdab6e630859d59 why char *p = - all new ---------------------------------- On Mon, 08 Nov 2004 19:35:46 -0500, "hari4063" ... (assuming "this" is writing into a string literal value) It (actually GCC, which is the compiler mingw includes) does warn if you use -Wwrite-strings. More specifically it ( nonstandardly) makes the string literal value officially const and so warns about losing const qualification on the pointer; if you fix that by qualifying the pointer, it warns about any attempt to store through it, unless you cast away the const somewhere or cheat (by punning, or strchr etc.)... - Sun, Nov 14 2004 8:09 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/590bb89a41716dd1 Confused about functions - all new ---------------------------------- ... Not quite. In C89 the array bound must either be omitted -- double x[] -- or a constant expression, which n is not. The (topmost) bound of an array function parameter is ignored in rewriting to pointer, so in C99 T x[n] and T x[] both mean the same as T*x; in C89 only the latter is permitted and it does mean the same. - David.Thompson1 at worldnet.att.net ... - Sun, Nov 14 2004 8:09 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e5ef06e0b57dfb4 Functions as function parameter - all new ---------------------------------- On 8 Nov 2004 11:19:05 GMT, Joona I Palaste wrote: ... Or you can omit the parameter names, if you prefer: void my_sqsort (double *a, int n, int (* comp_func)(double *, double *) ) Since the parameter names aren't used/usable within this function (only the function to which this parameter points) this is arguably clearer; however it differs from the target function definition ( even) if that is (also) in prototype format which you may dislike. Or you can omit the parameter description... - Sun, Nov 14 2004 8:09 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f8b840ac2761f8f8 Newbie: Output to a file - all new ---------------------------------- On Sun, 07 Nov 2004 12:58:29 +0100, Stefan Nowy wrote: ... Although it's outside the scope of C as such, on many systems ./myprog > output.txt will ( re)direct to the specified file any output by the program _on stdout_ -- that is by printf, putchar, etc., or by fprintf, fputc, etc. using (the value of) stdout for the fp argument. On any (hosted) C implementation, output using fprintf, fputc, etc. using an fp returned from a successful fopen with some filename and a mode of (or including) "w", will go to that... - Sun, Nov 14 2004 8:09 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/cafbf0aedb5969fa ======================================================================= You received this message because you are subscribed to the Google Groups "comp.lang.c". comp.lang.c http://groups-beta.google.com/group/comp.lang.c Change your subscription type & other preferences: * click http://groups-beta.google.com/group/comp.lang.c/subscribe Report abuse: * send email explaining the problem to [EMAIL PROTECTED] Unsubscribe: * click http://groups-beta.google.com/group/comp.lang.c/subscribe ======================================================================= Google Groups: http://groups-beta.google.com
