comp.lang.c http://groups-beta.google.com/group/comp.lang.c
Today's most active topics: * C function call cost. - 15 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c3f4cd2aa342d841 * srand() troubles - 12 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/cbe4162622b4bab5 * ping source code - 12 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/224b55f45e882482 * b = 2 / a[2] - 11 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/45f3894f7f0c97d7 * variable changed, but i didn't change is. - 11 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e8c4192f882ca31d Active Topics ============= speed of int vs bool for large matrix - 4 new ---------------------------------- ... Er, wherever I said 8 here, I meant CHAR_BITS (not that we've seen a machine with CHAR_BITS != 8 in a long time, but at least it kills the magic number and enhances compliance).... - Thurs, Sep 16 2004 1:07 am 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/cb38beb7c98d9c19 C external execution - trap stdout + stderr - 3 new ---------------------------------- ... To do anything more elaborate with these, you'll probably end up learning how to use pipe(), exec...(), and fork(). ... pclose() returns this. -- SM Ryan http://www.rawbw.com/~wyrmwif/ Quit killing people. That's high profile. . .. - Thurs, Sep 16 2004 1:35 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e28beb0f659cdffe #ifdef - 2 new ---------------------------------- ... There's a plethora of defines like this. They are defined by the compiler so that a source code can adapt itself to the compiler and operating system. . .. Generally, any _ or _ are defined or intentionally undefined by the compilers. The compiler documentation should explain which ones it defines and to what values. -- SM Ryan http://www.rawbw.com/~wyrmwif/ So....that would make Bethany part black? ... - Thurs, Sep 16 2004 1:35 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3bd78f7e89e53da8 array a[(foo)()] (help) - 9 new ---------------------------------- int (*foo)(void); int bar(void) { unsigned int a = 10; foo = &bar; return a; ... int main(void) { unsigned int a[(foo)()]; printf("%d\n", sizeof a); return 0; ... Array 'a' can not be decleared with size 10 * 4 size? Please help. ... - Thurs, Sep 16 2004 2:16 am 9 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d593aac6cf21b66f b = 2 / a[2] - 11 new ---------------------------------- Sorry for this simple question. int main(void) { unsigned int a[4]={3,5,7} ,b; b = 2 / a[2]; printf("%d %d\n",sizeof a,b); return 0; ... Is this a UB. I searched through the std and could not able to find out. ... - Thurs, Sep 16 2004 2:20 am 11 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/45f3894f7f0c97d7 string & bytes - 4 new ---------------------------------- ... Now my solution is to append a preprocess word "__attribute__ ((packed))" (under Linux) after the struct, just like below: struct packet{ ... ... - Thurs, Sep 16 2004 12:13 am 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c28d3d26a0a9eaee union access - 6 new ---------------------------------- ... reprehension from Dan, I went on and produced more rubbish instead of shutting up. ... to a aggregate type and vice versa, but not a pointer to/ from an arithmetic type. It is always incorrect C, so the hierarchy of mutually assignable types could be restricted to the arithmetic types. Mark .. . - Thurs, Sep 16 2004 2:57 am 6 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ae5339a09d904e21 C library VS (Unix) System calls ? - 5 new ---------------------------------- Hi, I have a question that deals with the standard c library VS (Unix) system calls. The question is: which header files (and functions) are part of the C library and which header files (and function calls) are part of the (Unix) system calls. The cause of my confusion is that for example stdio.h is considered both as a header file of the C library, as well as a header file of the (Unix) system calls? Indeed, all of the following 18 standard C headers are part of the (Unix) system call headers as well. The full set of 18 Standard C headers: ... - Thurs, Sep 16 2004 3:24 am 5 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e9d56b80673b6d31 Tips on gaining proficiency in C - 2 new ---------------------------------- ... <OT> a-la Matrix ... :) </OT> ... Thanks for the advice! My usage of the term "utility" is downright misleading. It is more of a major project with 10+ full time developers. ... I already have read the C FAQs end to end, but most of it passed through due to the fact that I did not actually write code when reading. Thanks to everyone for their tips and suggestions ! Regards Abhi ... - Thurs, Sep 16 2004 3:39 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9d4264dd7b9939f9 about header files - 6 new ---------------------------------- hi, I wish to know whjat are all the header files used in c and their use with example. Regards, sudha. ... - Thurs, Sep 16 2004 4:01 am 6 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3e171dfea372f1b4 Warnings when using % operator - 5 new ---------------------------------- ... I believe the standard for % changed between C90 and C99. So it might be wide to make the macro depend on the standard version. This won't help with non-standard systems, such as many embedded compilers. My preference is that the modulo operation adjust the signs so that the denominator is positive, and then return a value with the sign of the numerator. I don't think the standards agree with me. ... - Thurs, Sep 16 2004 5:08 am 5 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/74be46f68898cb9f Difference between Structure & Union - all new ---------------------------------- ... Hi CSuda, Now you be trained, how to post Q and Doubts in this Group. Good. Keep it up. Seenivasan (Vasu) ...... - Thurs, Sep 16 2004 5:57 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/81a25756b583d370 Floating point number to binary - 10 new ---------------------------------- ... I don't think it is very clear what you are trying to do. For example, what do you think the binary representation of a decimal point is? Are you trying to learn something, as opposed to than actually *doing* something? If so, what are you trying to learn? ... - Thurs, Sep 16 2004 5:59 am 10 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e706d56b01a84359 Q: Type'ing the infamous 'flags' field - 10 new ---------------------------------- I write a lot of drivers and there is inevitably some hardware register or buffer descriptor field called 'flags'. The flags are defined, typically, as bit positions. I was thinking I could get some compile-time type checking when assigning to a flag field but I don't think I can. Here's what I was thinking: typedef unsigned long HwFlag; struct HwThing { SomeType fieldOne; SomeType fieldTwo; HwFlag flags; ... static const HwFlag flagA = 1 << 0; static const HwFlag flagB = 1 << 1; static const HwFlag flagC = 1 << 2;... - Thurs, Sep 16 2004 6:03 am 10 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/48da03290ab348d5 Wide string initializer syntax - all new ---------------------------------- ... The braces are also optional for initializers for scalar types. This consistency simplifies things for source-code generators, and means that {0} is a valid initializer for any object type or any array of unknown size (in a declaration where initialization is permitted). ... - Thurs, Sep 16 2004 7:08 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2cdb63f40db2686f Loop Optimization, Array Alignment - 5 new ---------------------------------- Hello, I'm using gcc 3.4.2 on a Xeon (P4) platform, all kinds of speed optimizations turned on. For the following loop R=(evaluate here); // float N=(evaluate here); // N min=1 max=100 median=66 for (i=0;i5 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/1184fe1e93506839 variable changed, but i didn't change is. - 11 new ---------------------------------- Hi, I do have the next code in my program: int main(void) { double a[6],x[ 5]; int i; ... { x[i] = 6; ... ... If I run it, first is says a[0] = 4 and later a[0] = 6. But I didn't change a[0]. How is that possible, do I do something wrong or is there a ghost in my computer switching bits ;). I compiled it on an other computer, and got the same problem. ... - Thurs, Sep 16 2004 9:11 am 11 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e8c4192f882ca31d C function call cost. - 15 new ---------------------------------- I knew it is OT, comp.lang.c is a very narrow group that talk about nothing except standard C. But I really need a group to ask this question, please redirect me to a *real* newsgroup if it is really OT. My question is about function call. In my program, I make a function called a lot of times. I want to see: What is the cost involved in a function call? If there is something like inlining call in c++, so that I can reduce the cost? Can I reduce function call cost by reducing number of argument, for example,... - Thurs, Sep 16 2004 9:32 am 15 messages, 12 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c3f4cd2aa342d841 Endianess: why does this code not change value on BE machine? - all new ---------------------------------- On Mon, 13 Sep 2004 15:29:05 -0700, Andrey Tarasevich ... Ok unsigned short getShortBE (unsigned char* data) {return (data[0] << (unsigned short) 8) | data[1];} ... - Thurs, Sep 16 2004 9:36 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/581dedf5e41b1cf6 free() dumps core with a segfault. - 2 new ---------------------------------- ... I have a similar problem that can have its origin in many functions wrote in C, C++ assembly. This is the right excuse for write a malloc-free routine based on the one in K&R book (and some other routine that check for memory leak and find where memory is re-written out of bounds). ... - Thurs, Sep 16 2004 9:36 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/69917295e9776154 C Beginner Question - 4 new ---------------------------------- How do I pass different types of argument such as short, int, long, etc.. to a function that does routine stuff? Example: int main() { short x=1; ... /* how to declare a function to accept different types of argument */ int bit_ count() { ... while (x!=0) { printf("count = %d and value of x = %d\n", count++, x); x<<=1; ... thanks ... - Thurs, Sep 16 2004 10:27 am 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ea3ee1ef0a652199 [OT?] What is (a) "plunger"? - 3 new ---------------------------------- ... <snip> ... Thanks. rjt... - Thurs, Sep 16 2004 10:39 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a10a1f005c8f5002 srand() troubles - 12 new ---------------------------------- Many of us watched the World Series of Poker this last week and plotted how we were to take over that world. My current problem begins with shuffling the deck. For the apps I've written before, I've always been satisfied with the usual: ... int main( 2 things) { time_t timer; int tja; srand(&timer); tja= rand(); printf("%?", tja); return(0); ... causes the generated pseudo-random to be around 23,000 with my implementation. Even though I've been careful to slice up the 32768 outcomes of rand() in a reasoned way, the... - Thurs, Sep 16 2004 10:42 am 12 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/cbe4162622b4bab5 system() doesnt give me the control back .. - 2 new ---------------------------------- Hello every one, In our Linux Encoding system, a copy of helix dna producer is running .... i wrote an applicatoin which can remotely communicate with the encoding machine ... Its function include 1. Kill currently running copy of the producer and 2. Restart the producer with new settings. killing part of the producer was quite easy. But restarting it is where i face problems. I use the system() function to issue the command. But the problem is helix producer doesnt give back the control to my program which makes my program... - Thurs, Sep 16 2004 11:03 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/53feadfccffbb952 Accessing members of array as a different type - 7 new ---------------------------------- Hi, I'm having trouble geting my head around this, although I know it's a pretty basic question. I have an application whereby an area of RAM is mapped to an array: unsigned char NV[128]; Two consequtive elements are used to hold an unsigned int (2 bytes on this platform). How do I access it as an unsigned int? e.g. unsigned int test; ... test = *(unsigned int *)(&(NV[15]); In this case, I'm trying to retrieve the unsigned int value represented by elements 15 & 16 of the array. It does not seem to be working.... - Thurs, Sep 16 2004 11:40 am 7 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3dada211e6610767 ping source code - 12 new ---------------------------------- I was reading through original source code of ping for some insight and was confused by unusual code. Entire listing available at: http://www.ping127001. com/pingpage/ping.html ... What does this mean? That is all of the # include's there are. main(argc, argv) char *argv[]; { That is how the main function starts. Is that legal? There are structs that are network related that I don't know where they come from because of the lack of any recongnizable #include file. The code is well organized and commented. I... - Thurs, Sep 16 2004 12:49 pm 12 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/224b55f45e882482 no lcm in standard library? - all new ---------------------------------- ... This is related to the division speed, shift speed and branch misprediction speed. On the obsolete G3 or G4 architecture, both of which are comparable to the AMD K6 architecture, branch misprediction speed is only slightly slower than the shift speed and a lot faster than the division speed. So the speed of the inner loop of the binary method, on average, makes up for the increased number of iterations -- in fact on small numbers the binary method should be faster than Euclid's method (this is what I saw on the K6... - Thurs, Sep 16 2004 1:03 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e55b228d2e9561d5 Please help beginner - 3 new ---------------------------------- static const char assertFileName[] = __FILE__; Assert(); This is normally found in applications, what does this mean ? Thanks in advance. ... - Thurs, Sep 16 2004 5:03 pm 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/41d70c6fb9cb07e2 Passing and returning arrays to and from functions - 3 new ---------------------------------- Can someone please help, I'm trying to pass an array to a function, do some operation on that array, then return it for further use. The errors I am getting for the following code are, differences in levels of indirection, so I feel it must have something to do with the way I am representing the array in the call and the return. Below I have commented the problem parts. Thanks in advance for any help offered. Pete ... char P10(char key[]); /* prototype */ void main() { char key[20]; int i; printf("\nEnter a 10 bit Binary Sting: ") ;... - Thurs, Sep 16 2004 7:08 pm 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/50e357c1706e0d40 Why not 64 bit under 32? - 3 new ---------------------------------- Why can't 64 bit code run under a 32 bit OS? I understand that perhaps you could address the memory but why not have some mixed in 64 bit instructions inside a 32 bit program running under a 32 bit OS? Does the processor have to change modes like the 386 did from a 286? Just curios. Kenneth ... - Thurs, Sep 16 2004 7:37 pm 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3a28116e8ca9d2f2 Does typecasting consume cpu cycles - all new ---------------------------------- ... Greetings to the C-Gurus, thanks for all the replies. Special thanks to Chris Torek, for giving a detailed explanation. The sample test program really helped. Rgds, Vinod ... - Thurs, Sep 16 2004 11:54 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/af94b8ec8a17687d need help with input and output files ASAP - all new ---------------------------------- This is what i want to do. Read a text file as an input and based on that file, Create an output text file which saves the contents of the input file in a specific format in the output file. I know how to read a text file and i can even display the contents of the input file on the prompt. However i am trying to figure out how to save the contents of the input file in a specific manner. example.; this is my input file (say numbers.txt) 1,2,3,4,5,6,7,8,9, 10 and data bytes 5. this is what i want in my output file... - Wed, Sep 15 2004 4:13 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/87df4278443e292e ======================================================================= 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 ------------------------ Yahoo! Groups Sponsor --------------------~--> $9.95 domain names from Yahoo!. Register anything. http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/BCfwlB/TM --------------------------------------------------------------------~-> <a href=http://English-12948197573.SpamPoison.com>Fight Spam! Click Here!</a> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/kumpulan/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
