comp.lang.c http://groups-beta.google.com/group/comp.lang.c
Today's most active topics: * vulnerabilities - 43 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/5f5c39262f0a735e * derangement: code review request - 26 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/63c5271ccb9149a * Commenting the source code. - 15 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f8fb8ea8330fb9ef * Pointer Guide Nearing Completion - 12 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3aeeb768080be25b * GetByte(int x, int n) - 10 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c5aa5da0d5dfa7f0 Active Topics ============= Unexpected repeating of my output function - 3 new ---------------------------------- ... ... There are a few more things wrong with your code main is incorrectly declared main doesn't return a value mixed declarations and code you don't have the declaration for rand() you used a C++ comment to indicate the error Solve them too! Happy Coding :-)... - Fri, Oct 22 2004 2:17 am 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8a98151730757f64 K&R2 2.3 : /n vs /r - 6 new ---------------------------------- "john blackburn" wrote in message news:[EMAIL PROTECTED] uk... ... I wrote a conversion program for Unix files, as I use Windows, mainly. This is compiled using MS VC++ compiler (but it's C! Honest). ... { char ch; // read in chars until EOF while ( (ch=getc(stdin)) != EOF ) .. . return (0); ... emits a crlf when it reads in lf! Magic! ... - Fri, Oct 22 2004 2:22 am 6 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a1db79165370e7e9 Inconsistent time zone - 3 new ---------------------------------- Hi all, I have a utility that uses the C library function strftime() to return the time zone name, but it returns "GMT Standard Time" on one computer, and "BST" (which it should be at the moment) on the other computer. Both PCs are Windows XP Pro Service Pack 2. Both have their time zone set to GMT + 0 (London). And in the Date & Time control panel applet, both show "GMT Standard Time" as the Current time zone. Both have the correct date and time values. Can anyone suggest what's going wrong here? Regards,... - Fri, Oct 22 2004 2:55 am 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e58dc4643ce07c99 Commenting the source code. - 15 new ---------------------------------- Hi, I know that this is off topic. but I didn't know where to post. Do you comment your source code while coding or after coding. for example: you write a procedure and after it is working, you'll comment it. or you write a line of code and a comment following. Thanks Profetas ... - Fri, Oct 22 2004 3:23 am 15 messages, 14 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f8fb8ea8330fb9ef Malloc/Free - freeing memory allocated by malloc - all new ---------------------------------- In article <[EMAIL PROTECTED]>, ... I can't imagine how you would _rely_ on it; the idea is just to increase the chance of finding bugs early. -- Richard ... - Fri, Oct 22 2004 3:23 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c1d9f42a01aa0d5d vulnerabilities - 43 new ---------------------------------- In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... ... Apparently not. ... - Fri, Oct 22 2004 3:46 am 43 messages, 12 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/5f5c39262f0a735e strncpy help (long) - 3 new ---------------------------------- In article <[EMAIL PROTECTED]>, ... For example, it doesn't match the openbsd definition: ... - jonathan ... - Fri, Oct 22 2004 3:52 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/48659d4c02c928fd contiguity of arrays - 2 new ---------------------------------- ... You completely missed the point. This applies to dereferencing p itself, but says nothing about pointer arithmetic on p. Dan... - Fri, Oct 22 2004 4:36 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/367141614adee786 Can a double always represent an int exactly? - 8 new ---------------------------------- ... I imagine that would depend on how division is implemented. Fred ... - Fri, Oct 22 2004 5:03 am 8 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c95ebe8b3d2253a rand() function doesn't work well?? - 8 new ---------------------------------- ... This is a record-setting event in terms of politeness and helpfulness given your crossposting use of that other language. MPJ ... - Fri, Oct 22 2004 5:34 am 8 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e5a5c561cf8ad5ba derangement: code review request - 26 new ---------------------------------- ... They can be considered ancient-style C comments, in the sense that they were in C's ancestry, the B language, but didn't make their way into C until C 99. It's safer (for you) to avoid them in code you post here. If someone else wants to compile your code in ANSI conforming mode, the compiler must diagnose your comments. Furthermore, it is an excellent idea for you to compile your code in ANSI conforming mode, until you get to the point where any deviation from ANSI C is deliberate, rather than accidental.... - Fri, Oct 22 2004 5:31 am 26 messages, 9 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/63c5271ccb9149a Pointer Guide Nearing Completion - 12 new ---------------------------------- ... Ok, then let me qualify that, as per the C FAQ: it does not point to any object or function. For all practical purposes, it points to nothing. Semantic disgressions are a tad petty I would think. (On the other hand, I should note that NULL can represent an uninitialized value, such as the NULL link at the end of a list) ... You're right. ... Of course I do, right in the introduction. I even attributed that development to Konrad Zuse to liven up the dry material. I will, however, instruct the reader that ints and... - Fri, Oct 22 2004 6:48 am 12 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3aeeb768080be25b glib: problem with GArray - 2 new ---------------------------------- ... Try the GTK mailing lists found at: http://www.gtk.org or the GNOME mailing lists found at: http://www.gnome.org Regards, Larry ... - Fri, Oct 22 2004 8:03 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/53908e0faa737711 I renounce the 1st to 33rd degree of Freemasonry------------------ - 5 new ---------------------------------- ... Your a Nazi, admit it. My father and grandfather were Freemasons and died racist with hookers in their bed. Telling me Freemasons went to the concentration camps to join is not going to work with me. LONG live Israel!!!! ... - Fri, Oct 22 2004 8:02 am 5 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/212a98ee72e0a3a4 GetByte(int x, int n) - 10 new ---------------------------------- ... This is at odds with the actual definition of the right shift operator: 5 The result of E1 >> E2 is E1 right-shifted E2 bit positions. If ... The only thing the underlined text leaves up to the implementor to define is the values of the bits filling the vacated bit positions. They can be all ones or all zeroes (the only cases one will see in real world implementations) or some arbitrary bit pattern defined by the implementor. The bits coming from right- shifting E1 have all well defined values. Dan... - Fri, Oct 22 2004 8:06 am 10 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c5aa5da0d5dfa7f0 Index out of bounds question - 4 new ---------------------------------- ... That's what I thought but it seemed sensible to double check. ... Right. My usual development mode includes at least one compilation that does strict prototype checking (always require a prototype, don't allow more than one declaration for any function). Sometimes this means extra compilations to handle code intended for pre-ANSI compilers or to allow macro calls to be type checked; but my experience has been that the extra checking is worth it. Thanks to Herbert, Ben and Dan (and anyone else I may have forgotten)... - Fri, Oct 22 2004 8:14 am 4 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d458cd0ea4ec6303 Safer and Better C - all new ---------------------------------- On Fri, 22 Oct 2004 07:16:56 GMT, [EMAIL PROTECTED] (Richard Bos) wrote: ... ... - Fri, Oct 22 2004 8:20 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8313ab0630871577 Undefined behavior? - 2 new ---------------------------------- On Fri, 22 Oct 2004 07:45:15 GMT, [EMAIL PROTECTED] (Richard Bos) wrote: ... Come now, I think you have us outclassed with your soccer riots. . ..... - Fri, Oct 22 2004 8:30 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8f55addc267dddd3 Where to start - 5 new ---------------------------------- ... Myself included. But this is a pointless distinction, in the context of the thread. Dan... - Fri, Oct 22 2004 8:34 am 5 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2d9446f21de9d328 lcc-win32 - 2 new ---------------------------------- ... What do you believe the actual intent was? To provide a deliberately broken specification for asctime()? IMHO, they were looking for a simple way of specifying the actual format of asctime's output and they made a less than optimal choice. They didn't meant asctime to be seen as a standalone member of the package. ... Why don't we have a single header covering the whole of the standard C library, something like <stdc.h> ? Because the standard C library was logically divided into packages and each... - Fri, Oct 22 2004 8:27 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/60059ee1489ebe79 How To Use C To Write A Web Server? - all new ---------------------------------- ... Not even then, since web browsers, as a rule, do not accept inbound connections. Now, if the OP wanted to write a server that accepted a connection from a browser, that would merely be off-topic. ... I'd recommend comp.protocols.tcp-ip, where the relevant protocols and some of the relevant APIs and techniques are discussed, and comp.infosystems.www.servers.misc, which covers this topic in general, but my feeling is the OP is nowhere near ready to tackle building an HTTP server. Writing an HTTP server from scratch is a... - Fri, Oct 22 2004 9:51 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e278273548c0f423 Multidimensional arrays - 6 new ---------------------------------- Hi: there is an issue that confuses me and the FAQ did not clarify it for me. ( Sorry I am just learning!) Let say I define a multidimensional array in my main routine as follows: int arr[2][3]={{0,1,2}, {3,4,2}}; and I pass the array as a parameter to a function declared by: int getsum(int arr[][], int numrows, int numcols) by calling getsum(arr,2,3) (getsum tries to sum up all the elements). I know that this is illegal, but I don't quite understand why. When arr is created (at compile time), we know exactly what its row... - Fri, Oct 22 2004 11:11 am 6 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/48aba658b773ccee Compiling a tar.gz source file in Windows - 5 new ---------------------------------- I have downloaded a couple of free C compiliers and a source file. What do i do now? How do I compile it? Adios, Peter -- <add signature here> .. . - Fri, Oct 22 2004 11:33 am 5 messages, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/b7b81639f263e544 Tail space in struct within struct - 4 new ---------------------------------- Consider the following structures: struct bar { ... Can I rely on the order of members such that _b1tail will occupy at least B1N bytes between b1 and b2?: &foo->b2 - &foo->b1 >= sizeof(struct bar) + BN So I can use &foo->b2 as the effective end of _b1tail? Thanks, Mike ... - Fri, Oct 22 2004 9:53 pm 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/476f0f5d52625f5 C was created by Commodore ! ! ! - 3 new ---------------------------------- The kernel of each C compiler is Commodore C64 BASIC V2 , because "C" means Commodore and that means all C programs are compatible with the C64. ... - Fri, Oct 22 2004 11:03 pm 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/eb4236c0492bc22c A good article about vulnerabilities - 2 new ---------------------------------- "Code injection in C and C++: A survey of vulnerabilities and Countermeasures" by Younan, Joosen and Piessens (July 2004) This is a very good review of the current stand in this field. All problems are described, and the different solutions to them are reviewed. Recommended jacob ... - Sat, Oct 23 2004 4:39 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a5d464a8c8effb64 Inititalising a char array from multiple sources - 2 new ---------------------------------- I wanted to do something like this: const char reg_defaultKey[30] = {REG_ DEFPATH, "\\" , VERSION}; What is the proper syntax? The above was just my best guess but it didn't work and I couldn't find any info on the correct way anywhere else. ... - Sat, Oct 23 2004 7:37 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/582d0bfc5d037530 offset of a member inside a structure - 2 new ---------------------------------- In article <news:[EMAIL PROTECTED]> ... Aside from the extra "&", this is the one in the comp.lang.c FAQ (question 2.14). ... Implementors are, of course, allowed to be "arbitrarily dirty" since they (presumably) control the horizontal and the vertical. Perhaps offsetof() is #define'd as: . .. for instance. :-) The subtractive version would in general remove any " nonzero null pointer bias" that might be left behind without the subtraction, but one would certainly hope that the implementor knows how he implemented his null pointers.... - Sat, Oct 23 2004 12:49 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/26a1930dff135b43 Interesting coding idea - 9 new ---------------------------------- Perhaps it would be interesting to program a virtual machine simulating an ancient computer (such as the pdp-7). Then, it would be rather interesting to code for it (porting gcc to it maybe?). I think it would be fun to play with the long-forgotten art of coding in machine language. And what about a fictional computer, such as one that works on an entirely different way (such as a non-binary computer)? It wouldn't be very useful, but it wouold be a very fun and very interesting thing to hack on. ... - Sat, Oct 23 2004 2: 54 pm 9 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e611d0a5242f22c0 Help with newb's project - 4 new ---------------------------------- Hi all, I'm new to C programming and looking for some help. I have a homework project to do and could use every tips, advises, code sample and references I can get. Here's what I need to do. I have a file named books.txt that contains all the informations on the books. Each book is a struc containing 6 fields written on separated line in the folder. I need to use the fgetc command to read the info of this file. The program must create 2 alphabetical order sorted by book's subject and for a same subject, the other info must be grouped... - Sat, Oct 23 2004 3:33 pm 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ad0d79201461916e simple question?? - 3 new ---------------------------------- Hi, I am new to C and learning it. could someone help me to understand the following code's output? I am having hard time understanding how n2 values like that?. To me all n2 values are equal to 1. What am i missing here? thanks in advance. output: n1 = 8 n1 = 4 n1 = 2 n2 = 2 n2 = 4 n2 = 8 code: ... void msort(int list[], int n) { int half1; int arr1[MAX/2+1]; int count = 0; if(n > 1) { ... int main() { int n = 8; int array[] = { 8, 3, 2, 9, 7, 1, 5, 4 }; msort(array, n); return 0; ...... - Sat, Oct 23 2004 3:49 pm 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3c591937bedada7d ======================================================================= 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
