comp.lang.c http://groups-beta.google.com/group/comp.lang.c
Today's most active topics: * Votes for Usenet Fsckwit of the Century Award - 20 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/898cdc6d36b7bdb1 * how the following printf statement works - 10 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/dcb4d2040af9abe4 * C to Java Byte Code - 8 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/88cb533585cafed4 * Survey on Newsgroup Behavior - 7 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/68b2a03b7c9914d0 * How to call a shell command within C? - 6 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/cd7d40b3c74475c9 Active Topics ============= [OT]Re: C to Java Byte Code - all new ---------------------------------- goose scribbled the following on comp.lang.c: ... That was Galga's idea. He is apparently quite fixated on personally insulting Paul Lutus. ... - Fri, Oct 29 2004 1:43 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f0fc6e7be97f176 how the following printf statement works - 10 new ---------------------------------- hi, Can anybody please tell me that how the following printf(...) statement works- main(){ int d=9; printf("%d",printf("%d")); return 0; ... The output is 91. Thanks, Aditya. ... - Fri, Oct 29 2004 1:59 am 10 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/dcb4d2040af9abe4 C to Java Byte Code - 8 new ---------------------------------- Paul wrote: ) False. For both programs, the result was not the intended, design output, ) the result one gets on a standard, contemporary C compiler. That, as I said before, is because it is non-portable code. If I compile your program with gcc (a standard, contemporary C compiler) on hardware that has 32- bit bytes, then I get the same result as MPC. Therefore, the result *is* the result one gets on a starndard, contemporary C compiler, and your claim is false. ) You know, you cannot argue facts away. This... - Fri, Oct 29 2004 2:13 am 8 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/88cb533585cafed4 How to call a shell command within C? - 6 new ---------------------------------- ... popen() is non-standard (or rather, it's not defined by the C standard; I think it's POSIX). ... - Fri, Oct 29 2004 2:21 am 6 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/cd7d40b3c74475c9 Can use macros to solve this problem? - 4 new ---------------------------------- I have a list of functions (all with suffix T). For each one, I need to implement the following: FunctionT() { if (some_condition) { // do some conversion first FunctionW(); // then do some processing ... { / / do some conversion first FunctionA(); // then do some processing ... The condition check, conversion and processing is the same for all functions. Any way to use macros to save all the hassle? Or perhaps with function pointers as well? ... - Fri, Oct 29 2004 2:28 am 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9d10811ec434717 Extract a function from C code? - 6 new ---------------------------------- ... Copy the following script into a file called "function_extractor.cwp": function_extractor ::= => if _ARGS.empty() error("function name expected on the command line"); ... // from here, copy what is parsed to the output file ... ['<' ignore_template_clause '>']? '(' // read parameters ignore_parenthesis ')' // in C++, ignore 'throw' or 'const' ... [# readIdentifier | '(' ignore_parenthesis ')']* // read the block of instructions '{' block '}' ] ; ignore_template_clause ::= [# readCString |... - Fri, Oct 29 2004 2:37 am 6 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/142137b736cb8ea0 Is this legal ? - 5 new ---------------------------------- ... Thanks a lot! It means that casting-out const is not as bad as I thought it was, and the promise is rather a weak one - more like a wishful thinking! I thought that the compiler may locally assume that after taking an address of an object into a pointer to const type version, the object won't change. I was wrong. It seems to me that `const' in C is a device to generate warnings or errors rather than to change semantics of a program. If we removed all ` const' quals from a program, the binary code output should not change,... - Fri, Oct 29 2004 3:06 am 5 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/dbe05ac54921bc92 Votes for Usenet Fsckwit of the Century Award - 20 new ---------------------------------- ... Do not look where you fell, but where you slipped. ... Names are easier to change than bad habits. And you are no execption to the rule. ... Are you certain? -- Lady Chatterly "I thought I'd <plonked> you, moron." -- Christopher A Lee ... - Fri, Oct 29 2004 3:21 am 20 messages, 10 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/898cdc6d36b7bdb1 Pointer Guide Nearing Completion - 2 new ---------------------------------- ... You didn't answer the question. In your example, couldn't the value of 'p', which is the memory address of 'i', be 48 if that is where 'i' resides (where the 42 is)? ... - Fri, Oct 29 2004 4:10 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3aeeb768080be25b data bus model... - 3 new ---------------------------------- Hello All, I have some basic questions regarding the implementation of a data bus model in a simulator. Its hard for me to realize how to model something of that sort in a simulator..suppose I need to model a 200mhz bus and contention on it..for data coming from memory. I copied fraction of code that does this..but I am not sure if it does what it is supposed to do..I have limited knowledge in modelling such implementations..I will be grateful if anybody could guide me in this manner.. ... req_size = 6; data_bus_access(){. .. - Fri, Oct 29 2004 4:17 am 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/7b6c6b42896b28f looking for a free smtp library (for windows) - all new ---------------------------------- I have a found a couple of them but they both append something to the effect of "this was sent using an unregistered version of x". Can anyone point me to a truly *free* smtp library? ... - Fri, Oct 29 2004 6:29 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/7582ff13d60d95da derangement: coding review request - 6 new ---------------------------------- /*derangement.c contributors: Eric Sosman, Dan Pop et ali*/ ... int main(){ int i; int m,n,tmp,t,top_num; int buys_for[FAMSIZ]; /*rand() prelims*/ top_ num=RAND_MAX - ( RAND_MAX % FAMSIZ) - 1; srand(time(NULL)); /*initialize*/ for (i = 0; i < FAMSIZ; i++) buys_for[i] = i; /*main control*/ /*permute randomly*/ for(m = 0; m < FAMSIZ; m++){ while(1){ ... /*remove collisions*/ for(m = 0; m < FAMSIZ; m++){ if (buys_for[m] == m){ ... if (buys_for[m] = = n ) continue; ... /*out to console*/ putchar('\n'); for(i = 0; i < FAMSIZ; i+ +) printf ("%3d",... - Fri, Oct 29 2004 6:37 am 6 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/63c5271ccb9149a Survey on Newsgroup Behavior - 7 new ---------------------------------- Hello everyone, my name is Jens Arndt, and I am writing a Master's Thesis about drivers of behavior in newsgroups. That's why I need your help. The comp. lang.c newsgroup is one of the few that fulfill the predefined requirements. Therefore, I would appreciate it if you could take 10 15 minutes to fill out my survey. You'll find it under the following link: The pages have been tested to be compatible with all recent browsers I'm aware of. In case that you experience any problems please don't hesitate to contact me (via... - Fri, Oct 29 2004 6:50 am 7 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/68b2a03b7c9914d0 rand() implementation - all new ---------------------------------- ... Maybe you need to call srand with an argument of 0? At least you need to make sure that both functions start at the same place. ... - Fri, Oct 29 2004 7:07 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/1e7efe7ef4874a38 Infinite loop problem in linklist - 2 new ---------------------------------- [snip] ... That's C++ style for comments. In C, use /* ... */ to comment code. ... - Fri, Oct 29 2004 8:32 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/587befc5e360a488 detect recursive C code - 2 new ---------------------------------- ... There are a number of static-analysis tools that generate call graphs from C source. Loops in the call graph indicate recursion. They're not guaranteed, though: - If the recursion only occurs in dead code which is never actually executed, you may have a false positive (depending on how you define "recursive C code" for your purposes). - It's hard for analyzers to detect recursion through function pointers, since they'd have to check every value such a pointer can be set to by the program; so if the code uses... - Fri, Oct 29 2004 8:48 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4ec4eb836acd9e9d couple of questions on streams - all new ---------------------------------- ... All POSIX systems offer "low-level" and "unbuffered" I/O facilities to their hosted C implementations; it's required by the standard (currently the " Austin Group" standard, which reconciles POSIX, SUS, and some others). I think it's entirely likely that someone will learn to use C on such a system. Care to provide any evidence otherwise? ... You can make that assumption, but it would be a stupid one. On POSIX systems, for example, processes with ordinary privileges are generally run with resource limits in force, so their.. . - Fri, Oct 29 2004 9:05 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/999c750f9c648b21 resolving a warning error - 5 new ---------------------------------- ... Free clue: the concept of compatible types is NOT implementation dependent. It is the C standard itself that specifies what types are compatible: 1 Two types have compatible type if their types are the ... Which is entirely irrelevant here: if the function declaration doesn't match the function definition, the behaviour is undefined: 2 All declarations that refer to the same object or function shall ... Dan... - Fri, Oct 29 2004 9:14 am 5 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/51163699c4d6ba84 Why can't constants have commas? - 2 new ---------------------------------- ... What part of "My code obfuscator gave me this" was too difficult for you to understand? Dan... - Fri, Oct 29 2004 9:56 am 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/63c83bd31dbb075d vulnerabilities - all new ---------------------------------- ... Not unless I could find the cat responsible for your obtuseness. Dan... - Fri, Oct 29 2004 9:53 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/5f5c39262f0a735e Strings in C source code - all new ---------------------------------- ... OTOH, Perl generates far better diagnostics than the average C compiler... Dan... - Fri, Oct 29 2004 9:49 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/5a77bf67f0cf4248 sorting an array of three kinds of stones - 4 new ---------------------------------- ... Story of my life ... :) ... Sincerely, -TJ Walls ... - Fri, Oct 29 2004 10:51 am 4 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/7cd8153678600095 Getting call stack (like dbx where cmd) - 3 new ---------------------------------- Is there a way (understandably non-portable) to get the call stack from within a function? That is, assuming the application has been compiled with symbols, get the list of calling function names (similar to dbx "where" command"). I am working with IBM compiler and AIX but any other OS/compiler solution would be interesting as well. To answer the inevitable question why I want this, I am writing a simple profiler for my library. However, within the library I want to distinguish which part of the application I was called from....... - Fri, Oct 29 2004 11:27 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/63a0f8e19d368307 Here is my full program excluding the search and delete functions - all new ---------------------------------- ... That's one of two dictionary definitions. From www.m-w.com: 2 a : SEX < the feminine gender> b : the behavioral, cultural, or psychological traits typically associated with one sex ... Well, the lucky ones do. :-) -Mike .. . - Fri, Oct 29 2004 11:46 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2096b9852d46b410 A bit off topic; setjmp/longjmp - 4 new ---------------------------------- I have a C program that I am trying to port to a Motorola 68k based system. It makes use of setjmp and longjmp which are not supported by my C compiler. I understand the general principle behind setjmp/longjmp, but I am somewhat lost in the detail of how to actually implement this in assembler. (My compiler supports in-line assembler which I hope will prove usefull). I will be very gratefull for any help or pointers with this problem. I am conversant with the x86 architecture, so an example from one of... - Fri, Oct 29 2004 12:27 pm 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ed72cab798ebd303 Confusion with C - 6 new ---------------------------------- Every day I prove that i am beginer with C (even I program in C or/and C++ for more than 5 years)! Some days ago I find code that use _REALY_ strange sintax, something like this: // - code - int a[10]; int i; for(i=0; i<10; i++) ... At first I think that is some compiler specific _hack_, but i find something that is called "array comutation"? So, using a[i] is same like *((a)+(i)). With this, upper code have (just little bit) logic. My questiona are: 1) is this portable 2) is this truely what C creators wanna to... - Fri, Oct 29 2004 4:41 pm 6 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4b902db955c715bb assert( x > 0.0 && 1 && x == 0.0 ) holding - 2 new ---------------------------------- I'm having problems with inconsistent floating point behavior resulting in e.g. assert( x > 0.0 && putchar('\n') && x == 0.0 ); holding. (Actually, my problem is the dual one where I get failed assertions for assertions that at first thought ought to hold, but that's not important.) At the end is a full program containing the above seemingly inconsistent assertion. On my x86 using gcc the assertion doesn't fail when x is of type double. AFAIK, what is happening is that at first x temporary resides in a 80 bit register with a higher precision... - Fri, Oct 29 2004 4:39 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d35b138dec22feed Compile error message - 3 new ---------------------------------- I am having a problem. I am attempting to compile the fte text editor (fte- 20020324-common.zip and fte-20020324-src.zip on Redhat linux 8.0. Among the error messages I get is the following: ... con_slang.cpp:249: cannot convert ` short unsigned int*' to `SLsmg_Char_Type*' for argument `1' to `unsigned int SLsmg_read_raw(SLsmg_Char_Type*, unsigned int)' ... The various definitions and usages: SLsmg_read_raw(linebuf, sizeof(slang_dchs)); unsigned short linebuf[sizeof(slang_dchs)]; extern unsigned int SLsmg_read_ raw... - Fri, Oct 29 2004 4:55 pm 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4a54da92b96bc3fd Segmentation Fault... - 3 new ---------------------------------- I'm trying to pass an array to a function, and change the values of that array, but I can't seem to figure it out.. Please help me figure out what I'm doing wrong... Any help would be appreciated... Even if it's "You can't change the value of a passed array." :) Thanks! Code: static int get_command_args(char * msg, char **args) { char *p; int i, loops; i = 0; loops = 0; p = args[i]; while(*msg && !(*msg == END_CHAR)) { loops++; fprintf( stdout, "%d\n", loops); *p++ = *msg++; if(*msg == ARG_CHAR) {... - Fri, Oct 29 2004 9:05 pm 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f59048347b785c0b Some Interview Questions - 2 new ---------------------------------- ... True enough. "Nonconforming" is the wrong term. Unfortunately, there was no really "right" term, which is why I gave an example for what I did mean. I could have said "code that is not strictly conforming", but plenty of not- strict C code is just fine under the Boehm collector. Another thread today just brought up the problem with terminology here. Some have proposed a phrase like "strongly conforming" code, to mean "code that works in reasonable situations". This, of course, invites consternation as to just what is... - Fri, Oct 29 2004 10:35 pm 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e352a550394ff15d position independet code - 2 new ---------------------------------- What is a position independent code ? What are the basic guidelines to keep in mind while writing a position independent code ? thanx for any help .... ... - Sat, Oct 30 2004 12:09 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/40760e48df627018 reentrant functions - 2 new ---------------------------------- what are reentrant functions? What are the characteristics of a reentrant code ? what things should be kept in mind while writing a reentrant code ? ... - Sat, Oct 30 2004 12:10 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8282d3ee818642b8 ======================================================================= 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
