comp.lang.c http://groups-beta.google.com/group/comp.lang.c
Today's most active topics: * random is not random enough? - 26 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/7f307ea8667d7b6b * problem abt printf on Turboc - 18 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8c6c0656bf1152bd * Address syntax - 14 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/59301cd1e7039807 * gcc: error: case label does not reduce to an integer constant - 12 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/fb0c6578b250322b * Problem doing an e-mail program in C - 12 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a07c053a6829c214 Active Topics ------------- Name help needed - 11 new ------------------------- ...Keith... who are you replying to? Is there _any_ prospect of any other compiler suite adopting his spawnings? Richard - Wed, Dec 29 2004 8:09 am 11 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d42b2ff2b7fd234b printf - 1 new -------------- ...That depends on what you need it for. If you want the source for _a_ version of printf(), at least one, probably several, are available on the web. Of course, they're likely to be pretty much implementation- specific, so they might be useless with your compiler. If you want the source for _your_ version of printf(), you'll have to ask your vendor. - Wed, Dec 29 2004 8:14 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e860a642872579b linklist - 1 new ---------------- ...You do not get infobahn's point, I'm afraid. Let me state it more clearly, then: Do Your Own Damn Homework. Richard - Wed, Dec 29 2004 8:34 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/7f40ece18106c1bd gcc: error: case label does not reduce to an integer constant - 12 new ---------------------------------------------------------------------- Ben Pfaff <[EMAIL PROTECTED]> spoke thus: ...That's just how I would have answered the question, and I wanted to know whether I would have been strictly correct (Flash's post suggests that the answer is "no"). Me trying to language- lawyer you would be about as dumb as me trying to do it to Dan Pop, or Dennis Ritchie himself for that matter :) - Wed, Dec 29 2004 8:50 am 12 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/fb0c6578b250322b How about this solution - 2 new ------------------------------- Thanks Jon Yi, But I was asked on starting from 1 and not zero. as you put: int i; for(i=0; i<10; i++){ a[i] = i; printf("%d ",a[i]); it bring the output from 0 to 9. now,I am asking if i put like this: a[i]=i +1 then,the out put will show: 1 2 3 4 5 6 7 8 9 10 what do you think about?Is it a correct way or no? - Wed, Dec 29 2004 1:13 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/76186e4e56f045fd detecting memory corruption - 2 new ----------------------------------- ...Well - one possible way is to redefine macros for malloc and free and write your implementation to keep track of the memory invocations. ( and deletions ). And you can identify memory leaks / corruptions hence. <OT> Tools like ElectricFence and GNU mtrace are available precisely for these purposes but they may be restricted to the implementation. - Mon, Dec 27 2004 6:45 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/879fd7c0feaac206 about the keyword "register" - 5 new ------------------------------------ ...First, any operation can be eliminated if its result isn't used, which I think is what was happening with the OP's code. Leaving that aside, there are a lot of cases where a multiplication by a constant can be replaced by some cheaper operation such as a shift or an addition (assuming the compiler knows, or can guess, how - Wed, Dec 29 2004 9:28 am 5 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/24fe35bd10111bf7 Help with Constant Define--Compiler Issue with ANSI or my compiler or me? - 3 new --- ----snip ...long integrator; integrator=0; if (integrator>POSITIVE_INTEGRATOR_ SATURATION) integrator=POSITIVE_INTEGRATOR_SATURATION; if (integrator<NEGATIVE_ INTEGRATOR_SATURATION) integrator=NEGATIVE_INTEGRATOR_SATURATION; 1. Why does the executable always assign NEGATIVE_INTEGRATOR_SATURATION to integrator? - Wed, Dec 29 2004 9:32 am 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f010d7f1ff0f5c1c gcc bug with const on multidimentional arrays ? - 1 new ------------------------------------------------------- <Context> $ cat > glop.c <<EOF int titi(const int (*i)[1]) { return i[0][0]; .. .int main(void) { int i[][1] = {{1}}; titi(i); /* line 6 is here */ return 0; . ..EOF $ gcc -Wall -pedantic -std=c99 -c glop.c glop.c: In function `main': glop.c:6: warning: passing arg 1 of `titi' from incompatible pointer type - Wed, Dec 29 2004 10:32 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/163e062d59796e61 Got time? - 9 new ----------------- ...Start ...To keep it simple. - Wed, Dec 29 2004 11:04 am 9 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a77c1d53b6055c04 Couple of questions about compilers on linux - 5 new ---------------------------------------------------- Hi What is a good C/C++ compiler for a 64-bit linux system? I'm thinking of building a new PC and want to put an AMD64 in it. Since I've already got one windows PC, windows isn't free, and isn't even past beta in 64-bit, I thought I'd go for a fedora linux box. But I've no idea what compiler to use - presumably it'd be gcc, but which? - Wed, Dec 29 2004 10:15 am 5 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9e962541220657d6 Pointers are writing a messaging proxy in C - 1 new --------------------------------------------------- ...At the C language level you have things like functions, internal/external linkage, separately compiled source files and headers. ...Possibly but that is an implementation detail, not something that the C language itself covers. Since you mention POSIX and FreeBSD comp.unix.programmer or a FreeBSD related newsgroup would be a good place - Wed, Dec 29 2004 10:30 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c26982b324cdfc1b Pointer initialization question... - 3 new ------------------------------------------ ...If he meant that all-bits-zero doesn't necessarily mean NULL, then I owe him an apology. If he didn't, I don't. :-) - Wed, Dec 29 2004 11:05 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a73a5b31bd5dd852 Address syntax - 14 new ----------------------- Hi all, In the code snippet below I successfully determine the address of val1: * struct o val1=l_SYM_2B(&a).o[0]; print_aesthetic(&val1); The structure o is heavyweight. I understand (hopefully correctly) that (barring compiler optimisations) C will shallow copy the structure into val1. As I merely wished to pass the structure to print_aesthetic I combined the - Thurs, Dec 30 2004 12:48 am 14 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/59301cd1e7039807 problem with fgets - 7 new -------------------------- Hi all: my problem is in the comments of the code . would u please give me some clue what 's the problem? what u in advance. /**************************** ***/ ...int main(void) { FILE *p_file; static char *filename="test"; char *s= NULL; int c; int num=0; if ((p_file=fopen(filename,"w+"))==NULL) { /* does "w+ " means your - Wed, Dec 29 2004 8:06 pm 7 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f1bdcf398d38bd67 This C program prints 1 - why? - 1 new -------------------------------------- ...... ...any pointer that points to a valid object or else is a null pointer, specifically not any pointer to function unless the value is a null pointer. .. .You're passing a value of type ptrdiff_t (possibly promoted) but you told printf() that you're passing an unsigned int which is a type it cannot be. - Wed, Dec 29 2004 12:19 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/b36fabe7ede599ca Problem doing an e-mail program in C - 12 new --------------------------------------------- thanks a lot for all your replyes. the program is simplier than that, because it doesn't need to actyually send the e-mails.. I have the sheet with the specifications it has to have, but it's in portuguese.... I've already made some of it, the help menu, and the command that asks you for the adress, the subject and the message.. - Wed, Dec 29 2004 7:36 am 12 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a07c053a6829c214 problem abt printf on Turboc - 18 new ------------------------------------- Hello all , I need a help on this code kindly help me out for the below code I worked on the Turboc the result I was expecting was different from what has been printed I have indicated the line with " /*this one*/" line no 10 I did expected some junk for the first %ld and 6553 for the second %d ,but it printed in different way I am also pasting the result printed , - Wed, Dec 29 2004 4:48 am 18 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8c6c0656bf1152bd Problem with ABS() macro - 6 new -------------------------------- K.N. King's book "C Programming: A Modern Approach" gives this exercise in chapter 14, which is about the preprocessor: The following macro has a subtle problem: #define ABS(a) ((a)<0?-(a):a) Give an example that shows why ABS doesn't work, and show how to fix the problem. You may assume - Wed, Dec 29 2004 5:07 am 6 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/355864013e23345d decimal to hexadecimal - 1 new ------------------------------ "Johan" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: ... Oh, then what did he mean by: ...See how top posting screws everything up? - Wed, Dec 29 2004 1:27 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/fbe2ff0108e35248 two-dimensional array - 6 new ----------------------------- Dear experts, I selected this problem among off messages of this page: ... specified by an integer sequence about 9 times, store >the results from a[1] to a[9]. ...I tried as I was able,but the output of my solution is not satisfying the said matter in the problem.if possible,please show the correct method.thank you! - Wed, Dec 29 2004 6:24 am 6 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f310b23dcc18ee34 Pointers in c - 2 new --------------------- ...... ...It depends how far you are prepared to go. ...In a lot of cases of this type, certainly the interesting ones where doing this might provide a benefit, another_ptr is not accessible from the code that called free(). So then you have to track in some way other pointers that can point to the same object, transfer responsibility to - Wed, Dec 29 2004 2:38 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/fa61be9ea4fe3db1 random is not random enough? - 26 new ------------------------------------- I am using random to generate random numbers, thus: int x,y; for (y = 0;y < 5; y++) { x = random(50); cout << x; ...When I run this program, 5 random numbers are produced. However, if I stop the program and re-run it, the same sequence is produced. Am I forgetting to do something? Is there another random number generator - Wed, Dec 29 2004 6:57 am 26 messages, 15 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/7f307ea8667d7b6b linker: does it skip unused functions? - 9 new ---------------------------------------------- Hi, if I link my code to other o-files: Does the linker include the whole o- file or does it use the needed functions from that only? Felix - Wed, Dec 29 2004 4:52 pm 9 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/dae008f2ad1dc890 scanf in a for loop - 1 new --------------------------- ...That is a good idea here, but isn't what he meant. ...The problem with that is knowing when to stop. C has no way to query whether the character read is the last available or whether there are any more. Anyway why should a program assume that characters already there aren't valid? That's not the cause of the problem in this case. - Wed, Dec 29 2004 4:07 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/aebc3f924a267595 serial port communication (linux) - 1 new ----------------------------------------- ...That will only work if by some freak accident the serial port is configured correctly to talk to the device and read/write data in an appropriate cooked or raw way. In practice the OP is likely to need to use platform specific APIs such as POSIX Termios. A good place to discuss that is comp.unix.programmer. - Wed, Dec 29 2004 4:17 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/688d852381a593ea Data Recovery SOURCE CODE ( SOURCE CODES of Professional Data Recovery Software ) - 1 new ------------------ Hi, I am a Data Recovery Specialist and Professional Data Recovery Software Developer in New Delhi. I've placed the Complete SOURCE CODE of One of my Data Recovery Software for Sale (for Educational Purpose) on the following link of my website: [link] I'd like to inform you that I am the author of World's First Book on - Wed, Dec 29 2004 9:10 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/70aa7c439786938d compiler bug or misuse of a cast? - 3 new ----------------------------------------- ...casts, ...if ...punning ...Thank you once again. This makes sense to me. One final question on this, if I may. Since this code void test(void) { void * pData=(void*)0x3400; (*(unsigned char**)&pData) += 4; memcpy((unsigned char *) pData, (unsigned char *)0x1000,10); return; ...apparently causes undefined behavior, is a compiler required to at - Wed, Dec 29 2004 9:29 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2f38d4d20f0d7c55 Reverse polish - 4 new ---------------------- I realise this but comp.programming and comp.theory seem to be dead newsgroups so I wasn't sure where else to post - Wed, Dec 29 2004 7:25 pm 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/b58e7aa433724b4a Text editor data structures - 1 new ----------------------------------- Much of this question is somewhat off-topic, since it deals more with software design than the C language in particular. For a beginner's exercise, using linked lists where each element is a line is probably the wisest approach. However if you want to be a bit more aggressive and make the editor a more "industrial grade", then I - Wed, Dec 29 2004 11:32 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/eef825317a6e56d0 what exactly is the difference between signed and unsigned in C? - 2 new ------------------------------------------------------------------------ To answer your question a bit more expansively, unsigned and signed ints are treated differently in terms of what condition flags are used to evaluate them per C relational operators. In plain english this means that a>b may have different answers depending on whether a and b are signed, unsigned, or mixed. - Wed, Dec 29 2004 11:41 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/1de4234406bae82c Creating a virtual File pointer - 3 new --------------------------------------- Maybe the title is a little misleading, but I don't know a better way of putting it. What I would like to do, is create a file pointer that really isn't pointing to an actual file on disk, but a string in memory. In other words whatever is being written to the file is actually being written to a string instead. - Wed, Dec 29 2004 12:55 pm 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ba964198fa07035e cmsg cancel <[EMAIL PROTECTED]> - 1 new ----------------------------------------------------- Please cancel <[EMAIL PROTECTED]>. This article was cancelled by the sysadmin at news.doit.wisc.edu because the article violated UW-madison news posting policies. - Wed, Dec 29 2004 1:26 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/751ac074b41fcd69 cmsg cancel <[EMAIL PROTECTED]> - 1 new ----------------------------------------------------- Please cancel <[EMAIL PROTECTED]>. This article was cancelled by the sysadmin at news.doit.wisc.edu because the article violated UW-madison news posting policies. - Wed, Dec 29 2004 1:37 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/516676c2a359a2d is NULL-checking redundant in accessor-functions? - 4 new --------------------------------------------------------- ...is ...Is that ok to return a pointer located in function stack? ...SEGFAULT ...invokes ...of ...above ...pointer... - Wed, Dec 29 2004 1:58 pm 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/fc3530088eb3edbc Coding standards - 4 new ------------------------ ...I find that form really annoying and when I see it in others code. It suggests to me that the person who wrote it doesn't understand boolean variables and the C idiom that was established with the C standard library. The idiom I am referring to is that functions should return a value that answers the question "Did anything go wrong and if so what was it?". By that - Wed, Dec 29 2004 9:58 pm 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/45fff8e456da3b6e understand a large system in C - 1 new -------------------------------------- Hi all, How you guys get familiar with a large system writtin in C? The reason I am asking this is that I found myself get lost usually when I take a new task (and start looking at the source code). There are tons of struct, unoin, define, variables, functions and people don't like to document the meaning/ usage of them. This confuses - Wed, Dec 29 2004 7:22 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d32a54a75402d344 question regarding stack size allocation - 3 new ------------------------------------------------ I am trying to corelate C code and its associated assembly code produced by gcc. In particular,I am trying to figure out how the stack pointer increments during variable initialization inside a function call. For this I have a very simple C program that only initializes an array in a function call. - Wed, Dec 29 2004 9:07 pm 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/eab52db1a73f3b21 Recommended style - 6 new ------------------------- Hi all, Which is the recommended style in production code for the following - . .. fp = fopen("xyz.txt", "r"); if (fp == NULL) { ... ...OR fp = fopen("xyz. txt", "r"); if (!fp) { ... ...Thanks. - Wed, Dec 29 2004 10:42 pm 6 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d8499543f20ad6a5 help with va_list etc - 4 new ----------------------------- Can anyone point me to any good online references about the va_arg() va_list() functions/macros I googled and found a couple of things, but what I found, failed to explain how it really works and give a easy to follow example program Any pointers appreciated. - Thurs, Dec 30 2004 5:53 pm 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/96adaf30f4b2b73 How to change a file's name through the C program? - 2 new ---------------------------------------------------------- Only I want to do is when I input a file's name in command line,the program can change the name by specified one.Could you give me some methods to do it? - Wed, Dec 29 2004 11:37 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2f4ddd6bcdb7ba73 ============================================================================== You received this message because you are subscribed to the Google Groups "comp.lang.c" group. To post to this group, send email to [EMAIL PROTECTED] or visit http://groups-beta.google.com/group/comp.lang.c To unsubscribe from this group, send email to [EMAIL PROTECTED] To change the way you get mail from this group, visit: http://groups-beta.google.com/group/comp.lang.c/subscribe To report abuse, send email explaining the problem to [EMAIL PROTECTED] ============================================================================== Google Groups: http://groups-beta.google.com
