comp.lang.c http://groups-beta.google.com/group/comp.lang.c
Today's most active topics: * ++i vs i++ - 19 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/5185f19742e42067 * struct and union alignment - 18 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9bd6e74130b2c03c * envp[i]!=(char *)0 - 11 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/6ec9703774acfcb3 * Disadvantage of using 'inline' - 9 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d87eaccd3d3874ba * strstr(char *str1, char *str2) - 9 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/b4f2749599e22f96 Active Topics ============= envp[i]!=(char *)0 - 11 new ---------------------------------- Rookie scribbled the following: ... The second-to-latest version of the C standard, published in 1990, hence the name. ... - Fri, Sep 24 2004 1:05 am 11 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/6ec9703774acfcb3 union access - 2 new ---------------------------------- ... Certainly, but I haven't done that. You can if you like, but it will make the discussion a bit pointless. ... I just wanted to seal off an exit I thought you might have been forced to take. I'm happy for you to have thrown away the key yourself. ... - Fri, Sep 24 2004 1:04 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ae5339a09d904e21 ++i vs i++ - 19 new ---------------------------------- ... Personally, I find the first one easier to read. ... It's all subjective to who the code's audience is. To experienced programmers, operators like '++' become second nature. And consider: (*p). vs p-> Which is more readable and which is used more often? ... - Fri, Sep 24 2004 1:59 am 19 messages, 13 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/5185f19742e42067 Disadvantage of using 'inline' - 9 new ---------------------------------- If I don't care about the size of my executable or compile time, is there any reason why I wouldn't want to inline every function in my code to make the program run more efficient? ... - Fri, Sep 24 2004 3:05 am 9 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d87eaccd3d3874ba need help creating a tree of processes(implemented in C) - all new ---------------------------------- ... this problem: ... void spawn(int depth, int nchildren) { int i; int nc=nchildren; if(depth == 0) return; while(nc){ nc--; if( fork() != 0) { ... spawn(depth-1, nchildren); return; ... main() { int depth=4; /* depth i am taking 4 */ int nop=2; /* no of children */ printf("\nMAIN pid=%d,ppid=%d\ n",getpid(),getppid()); spawn(depth-1,nop); ...... - Fri, Sep 24 2004 3: 24 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8d063326bfc675e5 Malloc/Free - freeing memory allocated by malloc - all new ---------------------------------- ... Does this prove *anything* at all? ... Then why did you start it here in the first place? Dan... - Fri, Sep 24 2004 4:50 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c1d9f42a01aa0d5d Managing global vars between files - all new ---------------------------------- ... Furthermore, if used properly, global variables don't have a negative impact on the code readability/maintenability. For the small bits of local data needed by most functions (loop counters, temporary variables and so on) static allocation can be used instead of automatic allocation. Embedded control applications running on platforms with this kind of resources seldom use recursive functions... Dan... - Fri, Sep 24 2004 5:01 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/34560407c855474b Max Path [Newbie] - 3 new ---------------------------------- ... Since this definition is made available by including , no one should ever care from what file it actually comes from. ... If one could define MAX_PATH in a portable manner, there would be no need for FILENAME_MAX in . Dan... - Fri, Sep 24 2004 5:07 am 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c9baf271210d161a struct and union alignment - 18 new ---------------------------------- ... Right. extern char *pc; void free(void *p); free(pc); // correct (Note: we don't need same representation requirement in the above example. This requirement is necessary eg. for variadic arguments: printf("% p", pc); - no cast to void* required.) ... No. I see no reason to require same alignment for types void* and char*, because in function arguments they're passed by *value* (think conversion). Similarly, long and char do not have to have same alignment, but we may always use them in arguments... - Fri, Sep 24 2004 5:28 am 18 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9bd6e74130b2c03c Newbie-question: scanf alternatives? - 2 new ---------------------------------- ... I NEVER make any technical statement about the C standard if I am not prepared to support it with a chapter and verse. It may happen that my interpretation of the chapter and verse is incorrect, but this is another issue. Dan... - Fri, Sep 24 2004 5:22 am 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/7a737a53f44215a6 Pointer question [ Newbie ] - 3 new ---------------------------------- ... Exactly the same thing as in: int myint; where &myint yields the " address" of the variable myint. &intPtr yields the "address" of the variable intPtr. Pointers are trickier to the beginner because they have two associated addresses: the address of the pointed-to object and the address of the pointer itself. After intPtr = &myint; if intPtr is stored at address 0xf00 and myint is stored at address 0xdad evaluating intPtr will yield 0xdad (represented as a pointer value, not as an integer value), while & intPtr will... - Fri, Sep 24 2004 5:51 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/bb7fd15e5833bc3b 6 byte integer to string - all new ---------------------------------- ... If the platform can do 32-bit division (32-bit dividend and divisor to 32- bit quotient and remainder) in hardware, then the quickest way is probably to start by dividing the 48-bit number by 100000 in software. The remainder from that division contains the least significant five digits, and the quotient ( which is guaranteed to fit in 32 bits) contains the most significant digits. Then use the hardware divide to extract the digits from each part (dividing by 10). If there is no hardware divide, I don't know... - Fri, Sep 24 2004 6:44 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/b807abc621be51e5 elementary construction +1 - 2 new ---------------------------------- I'm now looking at page 115 K&R. After having discussed counterexamples, I shall herewith and henceforth make all my c programs look like int main(int orange, char* apple[]) {return(0);} Q1) How large is that int and that char*? (My instinct would be to look at limits.h, but with the main call, I can't figure out to what extent I'm %inside% C.) Q2) The example on 115 completely confuses me. That which is printf'ed looks like a batch file. How would the output change if the e in echo were omitted? MPJ... - Fri, Sep 24 2004 10:41 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/54b4e75539eebe6d C language portability support - 3 new ---------------------------------- In article <news:[EMAIL PROTECTED]> ... But good real-world C programmers will often follow many "rules" that will make their C programs far more portable than if they fail to follow them. ... Sensible people do so deliberately. ... "Complete" portability will indeed only result for a quite limited subset of "all possible C programs", but not all such programs should be labeled "trivial", in my opinion. (For instance, yacc/ bison and lex/flex are not "trivial", yet can be written entirely in... - Fri, Sep 24 2004 10:32 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/21c5964353b00772 strstr(char *str1, char *str2) - 9 new ---------------------------------- Hi there, I'm new to this C - never the less - I'm trying to search a string for the occurence of a substring - However, I'm not very succesful since my use of the strstr function always returns NULL. But I know that there exsists such a substring, as I can see it with my own two eye when I print out the string to be searched. I added the code of the function (resolveResponse)and how I call this code - Calling the function: - resolveResponse(buffer); - buffer is defined this way; - char buffer[8192];... - Fri, Sep 24 2004 3: 13 pm 9 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/b4f2749599e22f96 elementary construction - 2 new ---------------------------------- ... For a different sort of evil, you can use typedefs to pretend to change their types: main.h: typedef int f1oat; typedef char *doub1e[]; main.c: ... Perfectly valid ANSI C!... - Fri, Sep 24 2004 5:01 pm 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/eddddaac4ec842ce malloc and pointer hell - all new ---------------------------------- Groovy hepcat Barry Schwarz was jivin' on 22 Sep 2004 05:19:29 GMT in comp. lang.c. Re: malloc and pointer hell's a cool scene! Dig it! ... Wrong. The value of digit is modified in the loop. ... No it doesn't. It causes digit to be modified, and also dereferences the value of digit before the modification, discarding the result. It does not modify *digit. ... Actually, it is the value of digit itself that is now invalid. Dereferencing digit is a no-no. ... No it wasn't. ... Nonsense. ... Yes it does. .. .... - Fri, Sep 24 2004 7:21 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9d62f68addbbb21a memory - all new ---------------------------------- Groovy hepcat RoSsIaCrIiLoIA was jivin' on Wed, 22 Sep 2004 08:39:46 GMT in comp.lang.c. memory's a cool scene! Dig it! ... Indeed, why not? Please, go right ahead. ... And how are you going to do that? How can you possibly know what statement caused a corruption of the free memory pool or allocated memory? Maybe you could provide a function to check this. Such a function could be called after each suspect statement to test whether things have become corrupted. If it were me, I'd create my own allocation routines so I could have access to... - Fri, Sep 24 2004 7:21 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/39e68316868ed3f4 electronic component connection routing - all new ---------------------------------- hai, I'm trying to desing a GUI that would parse a text file, which contains a list of components and there pin connections, and disply a visualization of the connections. Im using Qt under Linux. I can parse the list and place the components the canvas that was easy. I'm stuck at the second part, connecting two points( onthe canvas i know the coords for each pin) with out overlapping any components doesn't seem as easy. I would like to know how exactly is board routing done?.. are there any simple algorithms(atleast a complex or... - Fri, Sep 24 2004 10:41 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/5b23d7948e6d67c4 Invoking A DOS Program Through A "C" Program - all new ---------------------------------- The easiest is system() as in : sytem("Doscmd"); DOS really? I heard it was dead. ... - Fri, Sep 24 2004 11:21 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ee48c3ae9265f0d2 contiguity of arrays - all new ---------------------------------- Is this legal? Must it print 4? int a[2][2] = {{1, 2}, {3, 4}}, *b = a[0]; printf("%d\n", *(b + 3)); --Steve ... - Fri, Sep 24 2004 11:22 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/367141614adee786 Clearly, it is too late to fix c99 - C is dead - all new ---------------------------------- ... In reply to a rant I posted on comp.lang.c. The point of my rant was that a large majority of existing compilers should have conformed with a large percentage of C99 back in '99. The purpose of releasing a standard is to codify existing practice. So when C99 was released it should have taken a few weeks for the majority of existing compilers to be tweaked to conform. That wasn't the case. The committee didn't codify existing practice, they made up a new language and they released it as a standard.... - Sat, Sep 25 2004 12:26 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2294ba70f0949aae ======================================================================= 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
