comp.lang.c
  Home FAQ Contact Sign in
comp.lang.c only
 
Advanced search
April 2008
motuwethfrsasuw
 123456 14
78910111213 15
14151617181920 16
21222324252627 17
282930     18
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.c Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  -atof- function , example from section 4.2 K&R2         


Author: arnuld
Date: Apr 3, 2008 23:58

This is the example from section 4.2, page 71 of K&R2:

double atof( char s[] )
{
int i, sign;
double val, power;

for( i = 0; isspace( s[i] ); ++i )
{
/* skipe the leading whitespace */
}

sign = ( (s[i] == '-') ? -1 : 1 );

if( s[i] == '+'|| s[i] == '-' )
{
++i;
/* skip the leading sign, of any */
}

for( val = 0.0; isdigit( s[i] ); ++i )
{
val = (10.0 * val) + (s[i] - '0');
Show full article (1.46Kb)
9 Comments
  Cheap Chopard Happy Beach Diamond Jeweled Fish Steel Blue Ladies Watch 27/8924 Wholesale, Replicas, Fake         


Author: sales050
Date: Apr 3, 2008 23:19

Cheap Chopard Happy Beach Diamond Jeweled Fish Steel Blue Ladies Watch
27/8924 Wholesale, Replicas, Fake

Chopard Happy Beach Diamond Jeweled Fish Steel Blue Ladies Watch
27/8924 Link : http://www.watches-replicas.com/Chopard-278924-2158.html

To Wholesale the cheapest Chopard Happy Beach Diamond Jeweled Fish
Steel Blue Ladies Watch 27/8924 in toppest Replica . www.watches-replicas.com
helps you to save money! Chopard-278924 , Chopard Happy Beach Diamond
Jeweled Fish Steel Blue Ladies Watch 27/8924 , Replias , Cheap ,
Fake , imitation , Chopard Watches

Chopard Happy Beach Diamond Jeweled Fish Steel Blue Ladies Watch
27/8924 Information :
Show full article (3.97Kb)
no comments
  Multithreading Books         


Author: DanielJohnson
Date: Apr 3, 2008 21:10

I know my question is not appropriate for this newgroup. But I only
need right reference to Books on Multithreading and Socket
Programming.

I am more interested in PSOIX threads and socket programming. Please
suggest some good books.
5 Comments
  Reading BSD system code         


Author: istillshine
Date: Apr 3, 2008 19:41

In string.h, I saw

__BEGIN_DECLS

...

__END_DECLS

What's the use of these labels? And why did they always put two
underscores before a name?

I also saw a function prototype declaration:

strlen(const char *) __pure;

Why adding __pure?
4 Comments
  Macro constants         


Author: Ioannis Vranos
Date: Apr 3, 2008 16:15

==> C90:

Errata for K&R2 page 232 (from
http://www-db-out.research.bell-labs.com/cm/cs/cbook/2ediffs.html):\

232(§A12.5): The result of the defined operator is not replaced
literally by 0L or 1L, nor are undefined names literally by 0L, but just
by plain 0 or 1. However, the constant expression is nevertheless
evaluated as if these and *other constants* appearing have long or
unsigned long type.

When it mentions "these and other constants", what are the other
constants implied?
8 Comments
  Not quite standard... but socially acceptable         


Author: Tomás Ó hÉilidhe
Date: Apr 3, 2008 11:38

I mainly keep my code as standard as possible, but I need to branch
out just a tad.

Firstly, if you're writing console programs for a system that has a
screen, a keyboard, and a commandline, then is there any commonly used
library for doing things like clearing the screen, or taking a single
key press from the user?

Secondly, is it OK, do you think, to flout C's rule of having to
define all objects at the beginning of a block? I've seen that a hell
of a lot of C compilers allow you to define objects wherever you want,
and I think it leads to far neater code, especially when it comes to
being able to use const in places where you previously weren't able.
26 Comments
  Is it possible to have two main functions in a c program?         


Author: mike-yue
Date: Apr 3, 2008 11:11

and, Is it possible to call one main function from another main
function?

Thanks guys.
22 Comments
  Software tools in Pascal: did I make a mistake?         


Author: noagbodjivictor
Date: Apr 3, 2008 10:32

Hello,

a while ago, someone asked a question about software engineering in C,
and someone else proposed Software tools in Pascal of Kernighan. And
pointed that it was not about Pascal at all. I went to Amazon, and the
comments also say the same thing.

Well I just got my order of the book; it came into my mail box today,
and the preface suggests a "Standard Pascal compiler." Oh no! Pascal
doesn't even exist nowadays...

What's in this book that a C programmer can learn? How is it related
to C.
Now that I have it, I must do something with it...

Thanks
4 Comments
  Debug statements         


Author: vivek
Date: Apr 3, 2008 08:58

Hi

i have used some debug macro and called several times(hundreds) in
the code.

The purpose of the macro was to print the values at that time to the
screen

Now that i have finished debugging, i do not want to execute the
macro.

If i use

#define DEBUG1

the code executes the statements inside the debug except that it is
not printing on the screen, which takes time.

Is there any better way(than commenting all hundreds of lines of
code)?

Thanks in Advance,
VIVEK
16 Comments
  would C be easier to read if...         


Author: Robert Smith
Date: Apr 3, 2008 06:47

some of the syntax wasn't overloaded so much...

Was just musing that if pointer de-referencing and pointer-to-type had
seperate syntax (ie use a character other than '*' for one of them) it would
make things much easier to read. You wouldn't get stuff like:

pthread_create(&thread, NULL, (void *(*)(void*))ThreadProc, (void
*)parameter);
28 Comments
1 2