comp.lang.c http://groups-beta.google.com/group/comp.lang.c
Today's most active topics: * How to determine available system calls on a Unix/Linux system - 17 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/21cd3c1aa175c1a4 * Out-of-bounds access and UB - 14 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/aa60e124041ec9c9 * Newbie-question: scanf alternatives? - 14 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/7a737a53f44215a6 * Pop's Device, was Re: Some Newb Problem with "int", please help. - 7 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/68cb42fb87cea0db * Malloc/Free - freeing memory allocated by malloc - 6 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c1d9f42a01aa0d5d Active Topics ============= Out-of-bounds access and UB - 14 new ---------------------------------- ... Using *any* C compiler, you get undefined behavior. lcc-win32 apparently does some compile-time checking in some cases (I presume it doesn't do run- time checking). That's a nice feature, but don't let it lull you into complacency; I doubt that it would be able to issue the warning if the array size and index value weren't determinable at compilation time. (And since Jacob's response is about the behavior of lcc-win32, not about the C language, it's arguably off-topic -- unless it was meant as an example of the kind of diagnostics a C... - Mon, Sep 20 2004 1:06 am 14 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/aa60e124041ec9c9 init of multdim array of structs... - 2 new ---------------------------------- Hi, isn't this corretc way to initialize a multi-dimensional array of structs in C?!? typedef int (*func)(int); typedef struct { int state; func f; ... cnt table[2][2] = { {{CLOSED,&f1},{OPEN,&noop}}, {{ILLEGAL,&illegal},{ OPEN,&f2}} ... (where CLOSED, f1, etc... are defined as ints and funcs.) TonyA ... - Mon, Sep 20 2004 1:33 am 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d8494507ab178e44 union access - 5 new ---------------------------------- ... Well, they are used for different purposes, and they perform different tasks. A union allows data to be stored as one type and read or manipulated as different type(s). For instance, storing a 32bit value and using the first byte as a char, the next 12bits as flags, 4bits as undefined, and a final chksum. That is not the purpose of a structure, which is a collection of variables that are passed around together, often as an array. There is no overlap of data, in fact there are usually "holes". union example {... - Mon, Sep 20 2004 1:33 am 5 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ae5339a09d904e21 How to determine available system calls on a Unix/Linux system - 17 new ---------------------------------- Hi, There are more than 1000 defined system calls in the Unix standard specification, however, a majority of them are optional and the availability of system calls are dependent on the OS implementation itself. The question I have is: How do you determine which system calls are available on any Unix/ Linux machine? The same question goes for determening available C library functions on any Unix/Linux machine? Best regards ... - Mon, Sep 20 2004 3:50 am 17 messages, 10 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/21cd3c1aa175c1a4 problem adding into a tree - 3 new ---------------------------------- Why does this code insert a node into a binary search tree correctly? If I only inserting going by first digit it works properly but when I try inserting going by the whole ip and the port number the inserts are totally out of order. where IPAddress is four ints Node is an IPAddress, portNumber, left pointer and right pointer Nodeptr is a pointer to a Node Nodeptr add(Nodeptr tree, IPAddress ip, int portNumber) { if(tree==NULL) { ... else if(ip.digit1 < tree->address.digit1) { tree->left = add(tree->left,... - Mon, Sep 20 2004 4:06 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a306d87f761f06ad Doubt-Efficiecy of 3D arrays - 4 new ---------------------------------- On Mon, 20 Sep 2004 06:34:03 GMT ... Actually, it is very dependant on the compiler and processor. A compiler is likely to convert a 3D to a calculated pointer access. Then it can do strength reduction of multiplication to repeated addition if you are looping over the array (and yes, I have seen compiler documentation listing this as one of the optimisations) and so you are down to what you would have had if you had implemented it as a 1D array. . .. Agreed. Write your code to be understandable otherwise it will be hell... - Mon, Sep 20 2004 3:17 am 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d588c24438bc97ac Newbie-question: scanf alternatives? - 14 new ---------------------------------- Hi, I'm a C-Newbie. What is the best (and securest) method to read a string from commandline? A code-sample would be cool. Thanks for help. Thomas ... - Mon, Sep 20 2004 4:14 am 14 messages, 10 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/7a737a53f44215a6 News - 3 new ---------------------------------- Check: http://www.pensacolanewsjournal.com ... - Mon, Sep 20 2004 4:36 am 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4101827c40aa7d79 Malloc/Free - freeing memory allocated by malloc - 6 new ---------------------------------- Is it really necessary to call free()? Can I make the assumption that the OS will do the clean up once the program terminates? For a linked list, I can step through the list and free one node at a time, but what about a dynamic array created by malloc? int *data = malloc(100 * sizeof(int)); Does free( data) frees all 100 elements or only the first one? Do I have to do the following in a loop? free(data[0]); free(data[1]); free(data[2]); ... I appreciate your input. Peter ... - Mon, Sep 20 2004 5:03 am 6 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c1d9f42a01aa0d5d C Beginner Question - 6 new ---------------------------------- ... I think we're talking about conversions and not promotions. ... This is the example: int main() { ... No, it doesn't depend on that. void bit_ count(long); takes care of int and short arguments. (int)-1 means exactly the same thing as -1 Both ((short)-1) and (-1) will be converted to ((long)-1) if used as arguments to a function with long parameters. ... - Mon, Sep 20 2004 5:46 am 6 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ea3ee1ef0a652199 Comparing Linux C and C++ Compilers: Benchmarks and Analysis - all new ---------------------------------- ... Scott, Terrific work ! I've been wishing to find exactly this. I'm looking for discussion groups, mailing lists, etc where folks discuss experiences in achieving optimizations. Thanks for your suggestions, on-line or off- Regards, -rajeev- ... - Mon, Sep 20 2004 7:03 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/5dbb9ae19db772cb Pop's Device, was Re: Some Newb Problem with "int", please help. - 7 new ---------------------------------- ... I disagree. /* BEGIN new.c */ ... int main(void) { int x, y, n, rc; long temp; char array[LENGTH + 1], *nptr; struct V { ... for (n = 0; VSIZE > n; ++n) { ... /* END new.c */ ... - Mon, Sep 20 2004 7:08 am 7 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/68cb42fb87cea0db Daylight saving - 2 new ---------------------------------- ... Been reading Discworld, have we, Mark? :-) Richard ... - Mon, Sep 20 2004 7:33 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a8f351326d6538ab Dynamically assigning data type - 2 new ---------------------------------- Hi guys, I'm trying to write a program that will read in a series of files and create a 3D array from the files read in for converting 2D images to 3D objects. The values read in will be considered as pixel colours and the size that 1 pixel occupies will depend on an input from the user when running the program. How can I dynamically change the data type of my 3D array at runtime. eg. 3D array was defined as type unsigned char in the code but the file to be read requires the array to be type unsigned short.... - Mon, Sep 20 2004 9:52 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/da2437735a66a1de question - all new ---------------------------------- ... all the switch statement, you should do, on the end of each case, unless you really want it to run the next case statement: ... ... - Mon, Sep 20 2004 12:27 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/80b0f524f70cef35 linux speaker beep - 2 new ---------------------------------- try this....Moonie you might need to use -DUSE_WIN32 or -DUSE_DOS or -DUSE_ LINUX and if using win32 to include windows and use dos to include dos.h and i believe i have include the right headers for linux..off topic of course. you can scream at my programming later. ... void DELAY( int msec ) { clock_t goal; goal = (clock_t) msec + clock(); while ( goal > clock() ); ... . .. void DoSound( unsigned int freq, unsigned int time ) { Beep( freq, time ); return; ... void nosound(void) { sound(0); return; ... void DoSound(unsigned int freq, unsigned int... - Mon, Sep 20 2004 8:25 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a0e2a5a961920995 <<<< FREE iPOD! NO GIMMICKS! FREE iPOD! >>>>> - all new ---------------------------------- http://www.freeiPods.com/default.aspx?referer=9227894 Here is what you need to do: 1. Click on the link above or paste it into the address bar of your browser. 2. Register an account. *It will prompt you for email addresses of five friends but referrals are not needed instantly. 3. Once you are registered, you must sign up for one offer out of the selection. *This is just to make these services better known, it is NOT a scam. ... ... - Mon, Sep 20 2004 3:16 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/de69c9ac8b35ea37 removing a loop from a linked list? - 5 new ---------------------------------- Based on an interview question I heard of but did not know the answer to....... How do you find and remove a loop from a singly linked list? In a google groups search I found the following code which will detect the loop but I am stumped how one would remove this loop. Any ideas? typedef enum { FALSE, TRUE } bool; /* The empty list is represented by NULL. */ typedef struct sList { ... /* Have two pointers into the list (l and m). Advance m twice as ...... - Mon, Sep 20 2004 3:21 pm 5 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/1e1b01c4c3215546 Problem with DO-WHILE Loop - 4 new ---------------------------------- Hello everyone. I am frustrated, I have written the simple program below for a class and I am having problems with the DO-WHILE loop. On the first run through the loop, everything works well, the menu is displayed, the input is registered and the loop runs. On the second (and following) runs the menu is printed twice. I am sure there is something very basic that I am missing, but I cannot see it. Can anyone help? Thanks in advance. Ken *Here is the code* /* currency.c - Version 1.2 This program receives a selection from the... - Mon, Sep 20 2004 6:06 pm 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ca04bd76119d745a Bete Test for MPC Compiler/IDE - all new ---------------------------------- Beta test timeframe : 20/9/2004 - 9/11/2004 We are inviting beta testers for our MPC (Multi Platform C) compiler/IDE. MPC compiles C programs and generate Java byte-code. This allows users to develop platform independent software without having to learn or use the Java programming language. The C language implemented is a large subset of ANSI C (1989). Currently the compiler/IDE only works on the Linux platform but we intend to port it to other platforms in the near future. Hardware Requirements : -Any x86 compatible personal... - Mon, Sep 20 2004 9:32 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/5114666378cad465 Error ifndef _REENTRANT? - all new ---------------------------------- Does _REENTRANT mean that all of your code has to be reentrant? If I do: ... . .. mbrtowc(..., &mb) ... Should I stick a #ifndef _REENTRANT error in there if the reentrant version of mbrtowc isn't available? I don't know in advance that this function will be called by multiple threads. What would you do in this case? Mike ... - Mon, Sep 20 2004 11:55 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/63620de600b89373 ======================================================================= 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
