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
  struct/union pointer/address stuff.         


Author: Kenneth Bull
Date: Apr 13, 2008 22:32

Say,

struct foo
{
int x;
double y;
/* etc. more variables defined */
short u;
char z;
} a;

Are the following true on all systems?

1) &a == &a.x
2) (&a.x < &a.y) && ( .. etc.. ) && ( &a.u < & a.z)

Are the following true if we change 'struct' to union above, on all
systems?

3) &a == &a.x
4) &a.? == &a.? where ?s can be x, y, ..., u, or z (not necessarily
equal for both ?s)

Thank you for the help.
1 Comment
  Struct/Union pointer stuff         


Author: Kenneth Bull
Date: Apr 13, 2008 22:29

Say,

struct foo
{
int x;
double y;
/* etc. more variables defined */
short u;
char z;
} a;

Are the following true on all systems?

1) &a == &a.x
2) (&a.x < &a.y) && ( .. etc.. ) && ( &a.u < & a.z)

Are the following true if we change 'struct' to 'union' above, on all
systems?

3) &a == &a.x
4) &a.? == &a.? where ?s can be x, y, ..., u, or z (not necessarily
equal for both ?s)

Thank you for the help.
2 Comments
  Replacing fgets Problem solved.         


Author: FireHead
Date: Apr 13, 2008 20:27

Hello comp.lang.c

Couple of years ago I created a topic as to how I can use the function
fgets so that I can read a line of text from a source of data.

After a long time I have finally got all of my initial questions
answered accordingly.

The code below is hereby allowed to be used anybody and modified
without any legal strings attached... Simple.

#ifndef _READLINES_
#define _READLINES_

#include
//#include
#include
#include

extern "C" short readLPostLine(FILE &rSource,char** content,int
default_length,signed int non_wanted_linefeeds);
extern "C" short readLine(FILE* pSource,char **content);
//using namespace std;

#endif

short readLPostLine(FILE &rSource,char** content,int
default_length,signed int non_wanted_linefeeds)
{
short ret=EXIT_SUCCESS;
int return_length;return_length = 0;
char* currentline;currentline...
Show full article (4.63Kb)
3 Comments
  discount, BBC ,jeans ( paypal accept ) ( www.sneaker-fan.com )discount, COOGI ,jeans ( paypal accept ) ( www.sneaker-fan.com )         


Author: cheapboot
Date: Apr 13, 2008 18:16

discount, AFTFUL DODGER ,jeans ( paypal accept )
( www.sneaker-fan.com )
discount, AKA STASH HOUSE ,jeans ( paypal accept )
( www.sneaker-fan.com )
discount, APE ,jeans ( paypal accept ) ( www.sneaker-fan.com
)
discount, BBC ,jeans ( paypal accept ) ( www.sneaker-fan.com
)
discount, COOGI ,jeans ( paypal accept )
( www.sneaker-fan.com )
discount, D&G ,jeans ( paypal accept ) ( www.sneaker-fan.com
)
discount, DIESEL ,jeans ( paypal accept )
( www.sneaker-fan.com )
discount, ED ,jeans ( paypal accept ) ( www.sneaker-fan.com
)
discount, EVISU ,jeans ( paypal accept )
( www.sneaker-fan.com )
discount, Gino ,jeans ( paypal accept )
( www.sneaker-fan.com ) ...
Show full article (8.70Kb)
no comments
  Buy cheap price nike jordan 1-23 shoes cheap coogi red monkey jeans in stock         


Author: myshoesbiz95
Date: Apr 13, 2008 18:14

china Wholesale New Air Jordan 12 X Air Force 1s Fusion shoes.
discount New Air Jordan 12 Fusion
cheap Air Jordan 5 x Air Force one Fusion
discount Air Jordan 5 and Air Force one Fusion,
Air Jordan 12 x Air Force One Fusion china online store
buy wholesale price Air Jordan 5 x Air Force ones Fusion
cheap Air Jordan 12 x Air Force 1s Fusion china distributor
discount Air Jordan x Air Force 1 Fusion china wholesale
customized Air Jordan 4 5 12 23 x Air Force 1 Fusion china
distributors outlets
all star air jordan 23 x nike air force ones Fusion china wholesale
for cheap

China wholesaler www.thenikeshoes.net of cheap air jordan
shoes,wholesale
jordans,wholesale jordans from china,wholesale nike jordans

www.thenikeshoes.net Buy new jordan 23 shoes, air jordan 23
shoes,jordan xx3,nike jordan
xxiii,new air jordan 23 shoes,AJ23,jordan 23
Show full article (1.26Kb)
no comments
  Write two separated objects?         


Author: Bryan Parkoff
Date: Apr 13, 2008 16:18

Can you please advise me how to write two separated objects?
Sometimes, two objects have the same variable name and function name, but
they have different algorithm to perform. The C++ Compiler allows you to
create two classes. Two classes bind their own local variables and local
functions.

For example:

Class Blue
{
int a;
int b;

int Run_Color (void);
};

Class Red
{
int a;
int b;

int Run_Color (void);
};
Show full article (2.00Kb)
7 Comments
  How to design a program in C?         


Author: istillshine
Date: Apr 13, 2008 16:07

Particularly for medium-sized (10,000 ~ 20,000 lines) programs, what
are useful strategies to design them before coding?

My strategies are:

1. Imagine what the final program would look like. Write down
options.

2. Write down many structures, such as

struct s1 {
/* contents */
};

struct s2 {
/* contents */
};

, and so on.

3. Write down many function prototypes, and classify them to different
.h files.

4. Write many macro definitions, such as "#define MAX_SIZE 100"

But having to change the original design during coding really troubles
me. Do you have any suggestions to avoid doing this?
5 Comments
  Using C as target language         


Author: thomas.mertes
Date: Apr 13, 2008 14:31

Generally C is well suited as target language for compilers.
I use C as target language for the Seed7 compiler. This
works good. There are just some things where the
behaviour of C is undefined:

The right shift operator (>>) of C may or may not sign
extend for signed negative numbers.

Since the right shift operation of Seed7 is defined as sign
extending shift, I have to check if the C compiler does
sign extend for signed negative numbers and to use the
following algorithm:

#ifdef RSHIFT_DOES_SIGN_EXTEND
(a >> b)
#else
(a < 0 ? ~(~a >> b) : a >> b)
#endif

Does somebody know some algorithm which delivers more
performance when the C right shift does not sign extend than
(a < 0 ? ~(~a >> b) : a >> b)?
Show full article (2.29Kb)
no comments
  Question on the FAQ         


Author: Topi Linkala
Date: Apr 13, 2008 12:33

Question 3.15:

Why does the code

double degC, degF;
degC = 5 / 9 * (degF - 32);

keep giving me 0?

Would the following rearrangement solve the problem?

degC = 5 * (degF - 32) / 9;

Topi Linkala
--
"The whole problem with the world is that fools and fanatics are
always so certain of themselves, but wiser people so full of doubts."
- Bertrand Russell
"How come he didn't put 'I think' at the end of it?" - Anonymous
22 Comments
  #define for very small numbers ?         


Author: pereges
Date: Apr 13, 2008 11:01

I need to define the plancks constant 6.67 X 10 exp -34. Is it
possible to do it using #define or would you suggest using a
(static ?)const double.
27 Comments
1 2 3