comp.lang.c http://groups-beta.google.com/group/comp.lang.c
Today's most active topics: * malloc and free - 11 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9dc6bf671c014afb * union access - 11 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ae5339a09d904e21 * Does typecasting consume cpu cycles - 8 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/af94b8ec8a17687d * how to convert very large number to hex string - 6 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ca4b7775f68dcf43 * Link compatibility among C compilers? - 4 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ab0aed3fc58b6cd9 Active Topics ============= typedef function pointer - all new ---------------------------------- Derrick Coetzee scribbled the following: ... That looks strangely like Haskell syntax. Perhaps later we will be seeing typedefs like this: type TypeFunc: ^(((int, int) -> int) -> (int -> int)); meaning "pointer to a function, which takes a function taking an (int, int) and returning int, an returns a function taking an int and returning int". This is not currently possible in either C or C++ because they can't manufacture new functions at run-time but it would be nice in some new mixed-paradigm language.... - Tues, Sep 14 2004 1:37 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/b59ff5cde814c4ec Does typecasting consume cpu cycles - 8 new ---------------------------------- I have a piece of code : - void *data; ... How is this different from simple assignment. int b = some_value; int a = b; /* assignment */ Does above typecasting (struct known_struct*) need some extra cpu cycles??? or is it a simple assignment like 'a = b'. Thanks for reply, Vinod ... - Tues, Sep 14 2004 2:36 am 8 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/af94b8ec8a17687d Geting info - all new ---------------------------------- ... ... - Tues, Sep 14 2004 3:11 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3fdd21309fee7cab Church's lambda calculus - 2 new ---------------------------------- ... It is /not/ impossible in C, and anyone who thinks so has a very limited worldview. As a trivial argument, I would say that most Scheme interpreters are written in C, and that the lambda calculus is trivially implementable in Scheme. A better argument would get into notions of effective computability and the ability of a languages to express primitive recursion. Suffice it to say, C can express primitive recursion just fine, and therefore any algorithm expressable in the lambda calculus can be written in C. That,... - Tues, Sep 14 2004 3:20 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/210b76dfb4421714 How to convert a double **ptr in a double const ** const ptr? - all new ---------------------------------- ... Fixed (swapped 'ptr' and 'c_ptr' on 2nd line). ... - Tues, Sep 14 2004 3:23 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/70276bb1b4eba7e1 no lcm in standard library? - 3 new ---------------------------------- ... I wouldn't say that I'm an absolute beginner in programming in c. I could write the functions lcm and gcd if I wanted to. But I just thought that there might be some mathematical hacks which would improve their efficency (e. g. dynamic programming, ...). ... - Tues, Sep 14 2004 3:45 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e55b228d2e9561d5 malloc and free - 11 new ---------------------------------- ... Again, there is no such thing as "implicit cast". A conversion may be implicit or explicit. If it is explicit it is called a cast.... - Tues, Sep 14 2004 3:53 am 11 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9dc6bf671c014afb removing Spaces - all new ---------------------------------- hi two ways: the barbarian one, set a char pointer at end of string, come back until black-char. Code: ... char *ppp = other_str+strlen(other_str); for(--ppp; ppp-other_str >0 && isspace(*ppp); --ppp); /* end for */ *ppp = 0; printf("|%s|\n",other_str); ... - a civilized one (costs more): ( assuming we can|must sqeeze spaces to one) Code: ... char *ppp, *qqq; register int blanc = 0; for(ppp = qqq = other_str; *ppp; ++ppp){ if( isspace(*ppp)){ ++blanc; continue; } if(blanc) *qqq++ = ' '; *qqq++ = *ppp; ... - Tues, Sep 14 2004 4:22 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/166d28f6a22645d0 How to know the memory pointed by a ptr is freed? - all new ---------------------------------- ... Oops .. I mis-read the earlier posts. You are not talking about NULL pointers, but on other (uninitialized or indeterminate) types of pointers. My earlier posting can be ignored.... - Tues, Sep 14 2004 6:13 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/86b30ce6a4ba5b2a C 99 compiler access - 2 new ---------------------------------- ... OTOH, that document is not entirely free from gratuitous non-ISOisms ( what's a __cdecl when it's at home, and where _is_ that home?). If they can pull off a document that neither uses non-ISO constructs as a starting point nor tries to introduce obvious M$-specific features in the new suggestions, I'd like to see them do so, but I'm not holding my breath. Richard ... - Tues, Sep 14 2004 7:19 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/6ab6fa86dd3e2204 Link compatibility among C compilers? - 4 new ---------------------------------- ... This is simply not true. That's why they are called "*Application* Binary Interface" and not "Operating System Binary Interface". An ABI describes everything related to one function calling another: how parameters are passed to the callee and how the return value is passed back to the caller. Having this defined by the ABI and not by one compiler or another ensures interoperability between modules compiled with different compilers. It is true that the ABI itself doesn't, typically, define the format of... - Tues, Sep 14 2004 7:29 am 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ab0aed3fc58b6cd9 speed of int vs bool for large matrix - 2 new ---------------------------------- ... How big is a bool in C? Isn't it strange that any language would make a bool bigger than a bit? I came across the same problem in Java once and someone told me that a bool is 32 bits! Imagine a one bit value stored in enough space for 32 one bit values? It must be a speed issue. The extra steps of doing bit manipulations would certainly slow things down if you are measuring speed by the number of steps the program must go through. I suppose you could sit down at the computer with your stop watch and... - Tues, Sep 14 2004 7:48 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/cb38beb7c98d9c19 Pointer arithmetic involving NULL pointers - 2 new ---------------------------------- ... I generally see the phrase "smart pointers" in reference to C++, where operator overloading lets the programmer do things behind the scenes when the pointer operators are used. Personally, I'd avoid using "smart pointers" for a case like this, since it's not a particularly descriptive term. The implementations I mentioned do indeed catch a variety of pointer errors. A fancy pointer representation isn't actually required for that purpose (an implementation might, for example, track valid pointers internally - the information doesn't... - Tues, Sep 14 2004 7:56 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ef9a1260c87b6bfc union access - 11 new ---------------------------------- typedef struct ntt { int type; union { int i; char* s; ... nt n; n.i = 0; I found a C example like this and could not get gcc 2.95.4 to compile it (struct has no member named `i') until I declared an instance of the union: union { int i; char* s; ... and accessed like: n.u.i = 0; Is the first example valid? If so, where is the problem? ... - Tues, Sep 14 2004 9:28 am 11 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ae5339a09d904e21 how to convert very large number to hex string - 6 new ---------------------------------- Hi, I have a number which is larger than the max unsigned long int. I don't have 64-bit integers available to me. I need to get the resulting 40-bit hex string. I can't find any algorithm or solution when I search the web. I've seen a couple of suggestions searching Usenet, but neither of them works. One tried to use a union, and the other tried to convert each byte of the float. There are a few open-source large-value math libraries, but none of them seems to include float-to-hex-string conversion. (And I find... - Tues, Sep 14 2004 9:49 am 6 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ca4b7775f68dcf43 Timer in a C Program - 3 new ---------------------------------- Dear All, main() { int num; printf("Enter a number "); scanf("%d",& num); ... In the above C program, I would like the user to allow only 20 seconds to enter any number. Just after 20 seconds, the program must terminate even if the user has not entered any number. How can I set such a timer in the above program. Also the decrementing time should be displayed on the screen, along with other output, Please suggest me a code in C to fullfill the above requirement. Margee S ... - Tues, Sep 14 2004 10: 08 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d7599d52aadb2149 switch and if..else same at assemby code ? - all new ---------------------------------- ... I've got perfect hash code at hex). The hash it generates for {2837, 3727 111, 203, 927, 542, 863, 666, 79, 44, 65, 63, 76, 17, 11, 39, 5, 7, 1, 709, 2978, 278, 57} produces each value in 0..22 once. The generated code for the hash function looks like ub1 tab[] = {15,0,13,13,0,24,31,7,7,18,7,0,31,27,26, 1}; ub4 phash(val) ub4 val; { ub4 a, b, rsl; val += 0x95188cc5; val += (val << 8); val ^= (val >> 4); b = (val >> 3) & 0xf; a = (val + (val << 12)) >> 28; rsl = (a^tab[b]); return rsl; ...... - Tues, Sep 14 2004 10:26 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/572cdb5d194ea929 pwd - all new ---------------------------------- hi does he not speaks about: current working directory in unix in 'c' ... - - guggach ... ... - Tues, Sep 14 2004 7:53 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3dfe7ed7e7d985ab [OT?] What is (a) "plunger"? - 3 new ---------------------------------- I've a question and a story to explain it, both of which are unlikely to be topical, but one never knows. Posting here because it's the only NG I've access to that might have an answer. I work in a software house as a tech writer. My cube is in the block next to the coder's bullpen, so I sometimes hear their discussions. I listen automatically because I have to be authoritative on the terminology, and never know when I'll hear something useful in any case. One fellow, an outside contractor programmer... - Tues, Sep 14 2004 2:17 pm 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a10a1f005c8f5002 Wide string initializer syntax - all new ---------------------------------- In article <news:[EMAIL PROTECTED]> ... Indeed, this is all correct and true, but it is not special to wide characters. Replace "wchar_t" with "char", and remove the uppercase L's, and it is still all correct and true. (Versions of gcc helpfully warn about incomplete/inconsistent brace- bracketing of the fourth line, given the appropriate options.)... - Tues, Sep 14 2004 6:56 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2cdb63f40db2686f Does realloc "move" a block it shortens? - all new ---------------------------------- On Sat, 11 Sep 2004 08:58:44 +0200, Francois Grieu ... snip ... determine if there is any undefined behavior when the block is relocated. It might be easier to maintain offsets or displacements which will be invariant regardless or relocation. <<Remove the del for email>> ... - Tues, Sep 14 2004 8: 13 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d20134ca0362e5fc Two Questions about "strlen", "strcat" and "strcpy" - all new ---------------------------------- ... Using strlcpy that would be (safely): len = strlcat(buff, " World!", sizeof buff); assuming buff is local so sizeof works. Otherwise supply that constant. Notice there is only one function call involved. Insufficient space is detectable after the call. ... - Tues, Sep 14 2004 10:21 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e9ba0a3a9129c3ba Gmail invitation - all new ---------------------------------- Hi, Can some one send me a Gmail invitation, please... [EMAIL PROTECTED] tia, -Meher ... - Tues, Sep 14 2004 11:26 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/79bb47615a8071f2 LINKER/LOADER DOUBT - all new ---------------------------------- Hi all, I m basically trying to understand the linking/loading process, please bear with me as i have specified my question in an unclear fashion. Any document that u think can clarify my doubts will also do, just specify the link of the doc. After reading some documents online, i have perceived that the some information about symbol resolution is built into the executable. ( WHAT EXACTLY IS THIS INFORMATION & HOW IT IS USED DURING THE COMPILE TIME & RUN TIME?, IF POSSIBLE EXPLAIN WITH SOME EXAMPLE). This... - Tues, Sep 14 2004 11:59 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/72e51c2673fa1aca free() dumps core with a segfault. - all new ---------------------------------- Folks, I am hitting a segfault while free()ing allocated memory - to make it short, I have a linked list, which I try to free node-by-node. While free()ing the 28th node (of total 40), I hit a segfault. This is legacy code. I tried debugging this problem, and am not able to come up with a valid reason for this. Following function is being used to free: void DBFreePUF (DBPUFRec * userp) { DBPUFRec *next_userp; /* Debug start. Added by me to walk over the list to count the nodes. */ DBPUFRec *tp = NULL; DBPUFRec *ap = NULL;... - Wed, Sep 15 2004 12:48 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/69917295e9776154 ======================================================================= 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/
