comp.lang.c
http://groups-beta.google.com/group/comp.lang.c

Today's most active topics:

* address of a statement in C - 30 new
  
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9c7bf5671accbcf6

* Getting time in milliseconds - 15 new
  
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/565dd04823f976b2

* Convert VB code to C code. - 12 new
  
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a12d4a4f10e5ab75

* Arraym malloc() and free() question - 12 new
  
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/6c0e0b0f81ee43bf

* Confused about functions - 10 new
  
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e5ef06e0b57dfb4

 
Active Topics
=============

Confused about functions - 10 new
----------------------------------
... I had a couple questions regarding the above function prototypes: 1. Is 
the 'n' in 'double x[n]' related to the first parameter 'int n'? I'm assuming 
it's not. 2. Does adding 'n' to 'double x[n]' mean anything in a function 
declaration? I'm assuming it doesn't. If my assumptions are correct, I'd 
think it's more clear to write 'double x[]' or just 'double[]' as your 
parameter. ... -   Tues,  Nov 9 2004 12:53 am
10 messages, 8 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e5ef06e0b57dfb4

Getting time in milliseconds - 15 new
----------------------------------
... There's nothing that guarantees that time_t is a time in seconds on all 
systems, at least the C standard does only says that time_t is a "arithmetic 
type capable of representing times". ... Even if time_t does return times in 
seconds that won't do you any good on a multi-tasking OS. What you try to do 
here is measure the time a call of time() takes - but that will only give you 
a useful result if the process gets all the CPU time during that 5 seconds. 
But on most modern operating systems the CPU time gets distributed... -   
Tues,  Nov 9 2004 1:08 am
15 messages, 8 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/565dd04823f976b2

Quiting a program using pure C - 4 new
----------------------------------
 ... I am sorry, I do not understand what you want to tell me. Just have a 
peek at this implementation of assert as my_assert. I just whipped it up but 
it should fulfill the basic requirements for assert. The first five assertions
will fail. Use MY_NDEBUG instead of NDEBUG for switching my_assert off. If 
this does not answer your question/complement your understanding/whatever feel
free to ask again. Cheers Michael ... int main (int argc, char **argv) {
switch (argc) { ... return 0; ...... -   Tues,  Nov 9 2004 1:14 am
4 messages, 4 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/64c944589e3ebd58

Jobs using C - 3 new
----------------------------------
Method Man <[EMAIL PROTECTED]> skriver: ... In my currect prohject the 
following 
languanges are used, C, C++, (C+ eg C code with C++ features...), perl, python,
 tcl, sh, java. Large progect tend to use a wide range of tools and lagnuages 
to get the job done. / Balp... -   Tues,  Nov 9 2004 1:10 am
3 messages, 3 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/df1e378aad3bcd

why char *p = "can not modiy"; char p[] = "can modify" - 6 new
----------------------------------
[Picking a post at random] ... [Various people say that it shouldn't/won't 
work] I have very vague recollections that there was (is?)a Unix library 
function (probably several) for generating temporary filenames: extern void 
mktemp(char *s); The idea was that you gave it a base name, such as "abcdef
0000000" and it would replace all the terminal digits with a sequential number,
 or something. Anyway, all the examples of its use that I saw, passed it a 
quoted (i.e. constant) string. Calling the function then overwrote that string.
... -   Tues,  Nov 9 2004 1:30 am
6 messages, 6 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/590bb89a41716dd1

Character arrays - 4 new
----------------------------------
Thanks for all your messages. I was just fiddling with my code and I wanted 
to know the reason why I could declare char str[0]...Anyways, learnt that I 
shouldnt do what I am not supposed to do !! :) But, compiler's indifference to
such a declaration is surprising.. I think it is due to the fact that there is
no array bound checking in C... Anitha Adusumilli ... -   Tues,  Nov 9 2004
1:48 am
4 messages, 4 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d7360ceb0613160

Crazy stuff - 3 new
----------------------------------
 ... OK. I sit corrected. ... quoted-string that ends with it. Richard [in 
PE12] ... -   Tues,  Nov 9 2004 1:43 am
3 messages, 3 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3bdab6e630859d59

DOS to Windows - 6 new
----------------------------------
... Class! Uh, I mean, Struct! ... -   Tues,  Nov 9 2004 1:57 am
6 messages, 5 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4ca2aabf9d2c03ad

simple c-code - 5 new
----------------------------------
 ... <snip> ... Bravo! ... -   Tues,  Nov 9 2004 2:02 am
5 messages, 4 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/aadecab38e4324ed

allocate space for typedef data type - 3 new
----------------------------------
... As well as the problems already mentioned by others, note that it is 
normally an error to assign the return value of realloc() to the pointer used 
as the first argument. If realloc() fails, it returns NULL, and leaves the old
allocation intact. If you overwrite your only copy of the pointer to the old 
allocation, then you can never deallocate it - you have a memory leak. For 
realloc(), I normally write something like: pid_t *ary, *temp; /* ... */ temp
= realloc(ary, (count + 1) * sizeof *temp); if (!temp) /* handle error, 
usually by... -   Tues,  Nov 9 2004 2:06 am
3 messages, 3 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/b0dc1e7314d9cc43

address of a statement in C - 30 new
----------------------------------
... The difference is, when reading code, on seeing 'break' or 'return' I 
don't need to think about anomalous control flow, because it can't happen. 
But if I see a 'goto' then I need to check; even if the control flow isn't 
screwed up, reading the code takes more effort because it might be. Not so 
with 'break' or 'return'. ... My recollection is that a 'goto' statement 
required more effort even if it was used in the context of an otherwise 
"structured" program. The study seemed fairly well done. Of course... -   
Tues,  Nov 9 2004 2:58 am
30 messages, 11 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9c7bf5671accbcf6

[Âà¿ý][Âà]­Í¬OÂà¤åÅ]¤H - all new
----------------------------------
¡° ¥»¤åÂà¿ý¦Û [Joke] ¬ÝªO µo«H¤H: [EMAIL PROTECTED] (LF), 
¬ÝªO: 
Joke ¼Ð ÃD: [Âà]­Í¬OÂà¤åÅ]¤H µo«H¯¸: ¬~§¾§¾¤p¯¸ (Tue 
Nov 9 19:39:20
2004) Âà«H¯¸: wwbbs.pu!news.cs.pu!ctu-peer!news.nctu!nctumenews!news.ind.
ntou!news.nt Origin: 140.112.107.77 ... ¤Þ ¨¥ ¹L ¦h ¦h ¦h ¦h ¦h ¦h 
-- [
1;32m¢~¢w [33mOrigin [32m¢wùß [36m¬~§¾§¾¤p¯¸ [31mcpp.twbbs.org 
[35m¡ã [
32m¢w¢w¢w¢w¢w¢q [m [1;32m¢u [33mAuthor [32m ùë [m211-74-120-167.
adsl.dynamic.seed.net.tw... -   Tues,  Nov 9 2004 4:05 am
1 message, 1 author
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/54c3a44e87e2af2

seq point/atomic var - 4 new
----------------------------------
Hi, Can anybody explain me the meanings of - 1. *Sequence Point* in a 
expression. For ex: arr[i++] = i; /* Is undefined cause of non intervening
seq point !*/ How does one go about computing the sequence point of long 
expressions. Any example illustrating seq points in long expressions would
be very helpful. 2. *Atomic access* ( context of signal handler) Thanks
in advance - Roopa ... -   Tues,  Nov 9 2004 4:55 am
4 messages, 4 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f2e29b9c7d05dd05

Convert VB code to C code. - 12 new
----------------------------------
... _Null_ character, please. Case is important. NULL is a macro expanding to 
a null pointer constant, not a character. (void *)0 is hardly a good string 
terminator, let alone '(void *)0'. Richard ... -   Tues,  Nov 9 2004 5:54 
am
12 messages, 8 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a12d4a4f10e5ab75

How to create a new directory in C - 3 new
----------------------------------
... Certainly. ... You never use this header. Eradicate it. ... No, really? 
I wonder what kind of comment you write when you use a dozen functions from a 
header. ... If you go back in the thread, you'll see that that is _exactly_ 
what the OP was doing. His problem was that it appeared not to work. Richard .
.. -   Tues,  Nov 9 2004 5:59 am
3 messages, 3 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2ec05d6e878117cc

memmem function - all new
----------------------------------
... It also invokes undefined behaviour, by defining a reserved identifier. 
Dan... -   Tues,  Nov 9 2004 10:51 am
1 message, 1 author
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/761668fd26c14a1

Argument Processing - 4 new
----------------------------------
... http://www.lysator.liu.se/c/bwk-tutor.html What if we wanted count to
return a value, say the number of characters read? The return statement 
allows for this too: ... Any expression can appear within the parentheses.
 This is a strong implication that, by the time this tutorial was written, 4
years before K&R1, returning a value *required* the parentheses. Even K&R1 
consistently uses them when returning values, although the syntax 
specification in Appendix A doesn't require them. It must have... -   Tues, 
Nov 9 2004 11:29 am
4 messages, 4 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/deee1550c7aee70

sig_atomic_t - 5 new
----------------------------------
... The "or" doesn't make any sense, Pentium being a 32-bit architecture it is
already included in the first question. ... Definitely NOT! There are 
systems that do not support byte accesses in hardware. Storing a byte on such
systems is far from what most of us would consider an atomic operation. ... 
sig_atomic_t is perfectly useful, on each conforming implementation, for the 
purpose documented in the standard. ... Note that sig_atomic_t only 
guarantees atomicity of store operations against another part of the same 
program... -   Tues,  Nov 9 2004 11:13 am
5 messages, 2 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/508401c550f64124

install source code to a drive other than "C:\" ? - 2 new
----------------------------------
On Tue, 09 Nov 2004 08:09:36 GMT ... Sorry, drive P isn't available since I 
took the P when I posted.... -   Tues,  Nov 9 2004 11:58 am
2 messages, 2 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/634b8bae451a91be

Newbie: Output to a file - all new
----------------------------------
... Add -Wall and fix your code until the compiler silently accepts it. When 
it complains about undeclared functions, don't provide dummy declarations 
yourself, include the right headers instead. Furthermore, don't use *any* 
library function without carefully reading its specification first and 
without checking if its call succeeded or not. Dan... -   Tues,  Nov 9 2004
12:46 pm
1 message, 1 author
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/cafbf0aedb5969fa

Newbie: warning - how can I fix it? - 9 new
----------------------------------
Hallo, here's a couple of lines from a function: fname(open) { *pwd, *err_
log; char *ctime(); long time(), now; FILE *fp; err_log = getenv(
"ERROR_LOG"); [...never mind the rest...] The code does compile and works (
Linux, gcc) - but everytime after compilation I've got an annoying warning: "
warning: assignment makes pointer from integer without a cast" - pointing at 
the line containing the assignment "err_log = getenv("ERROR_LOG");". I'm new
to C - I'm not sure, what's the problem. Could someone shortly... -   Tues,  
Nov 9 2004 3:13 pm
9 messages, 8 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/aaf465629baad817

C NEWBIE - 7 new
----------------------------------
 Does anybody have an article or any book refering to C language? -- This 
message has been sent using the astalavista.net newsreader webinterface. http:/
/www.astalavista.net/ ... -   Tues,  Nov 9 2004 3:53 pm
7 messages, 7 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a7fd82ca6b0797eb

Embedded application: C vs C++: a data point - all new
----------------------------------
In EE Times, 8-Nov-2004: < http://tinyurl.com/4oknj > ... -   Tues,  Nov 9
2004 5:03 pm
1 message, 1 author
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/7a3b0a4d72b3d79a

detect recursive C code - all new
----------------------------------
On 29 Oct 2004 15:48:59 GMT, [EMAIL PROTECTED] (Michael Wojcik) wrote: <snip>
 ... Or a static flag, (as little as) one bit, for each function. With 
somewhat simpler code; but still worth hiding, and also automating which helps
prevent cut&paste or other editing errors. - David.Thompson1 at worldnet.att.
net ... -   Tues,  Nov 9 2004 9:29 pm
1 message, 1 author
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4ec4eb836acd9e9d

Why can't constants have commas? - all new
----------------------------------
... ... No. enum values also must be (integer) constant expressions. - 
David.Thompson1 at worldnet.att.net ... -   Tues,  Nov 9 2004 9:29 pm
1 message, 1 author
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/63c83bd31dbb075d

Arraym malloc() and free() question - 12 new
----------------------------------
Hello, I have a question regarding malloc and free. Here my code sample: int 
main() { /* allocating dynamic memory for array */ int* array = (int*) 
malloc(5 * sizeof(int)); /* ... program code ... */ array = (int*) 
malloc(4 * sieof(int)); free(array); ... Now my question: The second time I
allocate memory for array, what happens to the address that I got with the 
first malloc? Is it freed automatically? Martin ... -   Tues,  Nov 9 2004 
10:44 pm
12 messages, 10 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/6c0e0b0f81ee43bf

Interesting coding idea - 3 new
----------------------------------
... Good point, Dave. While that can be done by a diagnostic virtual machine,
 it could also be done by a diagnostic compiler generating native code, which
would insert explicit tests in the generated code for duplicate pointers 
which must be different for well-defined behavior. The example code for the 
VM (snipped) required that the compiler identify sequence points, a 
diagnostic-only feature. If the compiler generates diagnostic code, it could
generate tests in native code (or function calls) as well.... -   Wed,  Nov
10 2004 12:01 am
3 messages, 2 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e611d0a5242f22c0

libavl example code? - 3 new
----------------------------------
Hello Ben, I want to use the libavl and read parts of your great documentation.
 But I didn't found practical examples, how to use the functions. Does anybody
can show me an example? Thank you in advance Manfred ... -   Wed,  Nov 10
2004 1:21 am
3 messages, 2 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/588248554fe11f58

(was: Doubts:Steve Summit's page/Chapter 22) - 5 new
----------------------------------
... But consider cases where this will fail. E.g. when the node is the last in
the list, or if there are pointers to list nodes held elsewhere by the program;
 having list nodes stay at the same location for their lifetime is a typical 
and sometimes useful property of a linked list. The normal solution to the 
stated problem is a doubly linked list. ... -   Wed,  Nov 10 2004 6:58 am
5 messages, 3 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c900023a84c1a83d

test(sorry) - 3 new
----------------------------------
test ... -   Wed,  Nov 10 2004 7:24 am
3 messages, 2 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ba681e75e7101951

derangement: coding review request - 9 new
----------------------------------
 ... int main(void){ int i; int m,n,t,topnum; int buysfor[FAMSIZ]; void 
swap(int *px, int *py){ int noscope; /* all pointers as ints */ noscope = *px;
 *px = *py; *py = noscope; ... /* initialize and permute */ for (i = 0; i <
FAMSIZ; i++) buysfor[i] = i; while (m < FAMSIZ){ t = rand(); if (t > 
topnum) continue; n = t % FAMSIZ; swap (&buysfor[m] , &buysfor[n]); /
* http://home.comcast.net/~beckjensen/range1.htm */ doesn't compile This is a
Moses Malone post: I'll get my own rebound. MPJ ... -   Wed,  Nov 10 
2004 8:14 am
9 messages, 4 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/63c5271ccb9149a

convert 'C' code to 'Fortran' - 9 new
----------------------------------
sam wrote: ... Wow, - good luck :) ... -   Wed,  Nov 10 2004 12:10 pm
9 messages, 8 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/7d307a1eec1f217a

Graph DFS implementation (stack usage) - 3 new
----------------------------------
Im trying to print out the order in which the vertexes of a graph are pushed 
on to the stack then print out the order in which they are popped off the 
stack. My current approach is void dfs(struct ADJACENCY *G_adj,int v) { 
int i,u; G_adj->mark[v]=1; visit(v,G_adj); while ((u=next_adj_
vertex(v,G_adj))>=0) { ... ... int visit(int v, struct ADJACENCY *G_adj) { 
printf("%c ", G_adj->vertexlabel[v]); return v; ... With this approach 
the order in which my graph should print out should be A, B, D, E , C , F ( 
order in which its... -   Wed,  Nov 10 2004 1:12 pm
3 messages, 3 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/26ac566c8dd4b053

using volatile ptrs ... - 2 new
----------------------------------
LBJ  scribbled the following: ... This question is entirely implementation-
specific. The C language does not even specify the terms "cacheable memory" or
"DRAM". Even assigning a direct address to a pointer in the first place causes
undefined behaviour. As far as the C language cares, a legal outcome of the 
above code is to paint your screen purple with pink spots and print "Cuckoo 
Cashew!" seventeen times in random locations, while renaming every file on 
your file system to a line from... -   Wed,  Nov 10 2004 1:20 pm
2 messages, 2 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ee0d0fd6df1c903

write 2D array to binary file - 3 new
----------------------------------
... Here's one problem, which may or may not be THE problem: you surely 
mean `sizeof(short)' rather than `sizeof(short*)'. The c.l.c. preferred style
clump_class = malloc(nrows * sizeof *clump_class); ... clump_class[i] = 
calloc(ncolumns, sizeof *clump_class[i]); ... makes this class of error hard 
to commit. On the face of it, though, this is unlikely to explain the 
particular symptom you're seeing. Still, when dealing with a baffling error 
it's always a good idea to fix all the known errors first, even... -   Wed,  
Nov 10 2004 3:34 pm
3 messages, 3 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/bbf704c50e884de7

Please review - 5 new
----------------------------------
I'm afraid I'm not in school, so I have no-one to ask but you nice folks. I 
learned most of this stuff from lurking around here, anyway. Are there any 
problems with this code? It appears to work on the (free) compilers I have. ..
. struct _my_struct; typedef void(callback_function) (struct _my_struct * arg);
 typedef struct _my_struct { int data; callback_function * cb_func; ...
 void any_callback_function (my_struct_t * b) { b->data <<= 1; ... { a-
>cb_func (a); ... int main (void) { my_struct_t ms = {0};... -   Wed,  
Nov 10 2004 6:11 pm
5 messages, 4 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c252fbe59cd39db0

Float point comparison-Newbie - 4 new
----------------------------------
... It depends on how you calculated the float variable and why you are 
comparing it to zero. Floating point calculations are often subject to 
roundoff error. An expression like (10.0*0.1 - 1.0) is likely to *NOT* come 
out exactly zero. If the floating point variable got the value 0.0 because 
you assigned the constant 0.0 to it, or you fed the text "0.0" into strtod() 
or [sf]scanf() as a marker for the end of the data, you are likely safe. The 
float variable will likely have exactly zero in it. On the other hand, if you
have calculated it by... -   Wed,  Nov 10 2004 7:07 pm
4 messages, 4 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/53ed451b64e71eb5

special character to strings and vice versa - 4 new
----------------------------------
 ... char s[] = "\x20\n"; char c1 = s[0]; char c2 = s[1]; ... You missed 
posting your code. -Mike ... -   Wed,  Nov 10 2004 7:54 pm
4 messages, 3 authors
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a42ff926b12a9709

c string - all new
----------------------------------
On Mon, 08 Nov 2004 11:36:55 +0100, slurper  wrote: ... There's no need to do
(FILE *)0 or (char *)0. Either 0 or NULL will do fine. Jim ... -   Wed,  
Nov 10 2004 9:26 pm
1 message, 1 author
http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/66a16943b9cacc4

 

=======================================================================

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   

Reply via email to