comp.lang.c
  Home FAQ Contact Sign in
comp.lang.c only
 
Advanced search
May 2008
motuwethfrsasuw
   1234 18
567891011 19
12131415161718 20
19202122232425 21
262728293031  22
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
  PUMA ADIDAS SNEAKERS         


Author: cnshoes64
Date: May 2, 2008 22:44

cheap Bape hoody,LRG hoody,BBC hoody discount Evisu hoody,Coogi
hoody,Kidrobot hoodies,A&F hot clothes,artful dodger hoody china
online shop ed hardy hoody for men and women,Artful Dodger
hoodies,A&Fsportwear, Urbanhotsale DOT net
no comments
  Example of the optimiser recognising a pattern         


Author: Tomás Ó hÉilidhe
Date: May 2, 2008 14:59

I'm working with a microcontroller at the moment that has a single
instruction for clearing a bit in a byte.

I started off with the following line of code:

x &= ~0x8u; /* Clear the 4th bit */

But then I changed it to the following because I thought I might get
more efficient assembler out of it:

x &= 0xF7u; /* Clear the 4th bit */

Suprisingly, the compiler produced more efficient code for the latter,
presumably because it recognises the pattern of " x &= ~y" for
clearing a single bit.

Anyway just thought I'd give an example of someone winding up with
less efficient code when their aim was to make the code more
efficient :-D
8 Comments
  program bug         


Author: Bill Cunningham
Date: May 2, 2008 14:40

I have looked this program up and down and I don't see what's wrong with
it. But it always breaks and gives me an error "mode error" no matter which
mode binary or text I choose. This simple program is supposed to take as
argv[1] a "b" or "t" for binary or text. It's not taking anything.

#include
Show full article (0.94Kb)
35 Comments
  Testing the keyboard buffer for MT/Not MT         


Author: NaN
Date: May 2, 2008 14:25

I've been trying to use _kbhit() but it didn't do what I thought it
would from books, "Detects whether a keypress is available for reading."

Herbert Schildt says,
"If the user has pressed a key, this function returns
true(non-0), but does not read the character.
If no keystroke is pending, kbhit() returns false (0)."

Here is the test code,

#include
void main(void) {
int ig1=0, ig2=0, ik=-1;
ig1 = _getch();
ik = _kbhit();
ig2 = _getch();
_getch();
printf("ig1=%%d, ik=%%d, ig2=%%d", ig1,ik,ig2);
return;
}
Show full article (0.77Kb)
3 Comments
  help required.         


Author: kaps
Date: May 2, 2008 14:16

Hello

What is the best IDE to use for C/C++ languages?
Previously I used "turbo c" compiler on Windows XP.

But now I switched to Windows Vista where I cant use it. I tried to
setup CDT eclipse but could not compile C program.

Can somebody please tell me which IDE is best and from where to
download?

Thanks

Please Help

Kapil Kumar
37 Comments
  Integer types in embedded systems         


Author: Tomás Ó hÉilidhe
Date: May 2, 2008 13:42

Let's say we had a simple function for returning the amount of days in
a month:

unsigned DaysInMonth(unsigned const month)
{
switch (month)
{
case 8:
case 3:
case 5:
case 10: return 30;

case 1: return 28;

default: return 31;
}
}

Notice the integer type I've used, i.e. "unsigned int" rather than
"unsigned char" or "unsigned short".

Many of the microcontrollers (i.e. a small chip that has a CPU and
RAM, basically it's a tiny little computer) in use nowadays do
arithmetic on 8-Bit numbers.
Show full article (2.41Kb)
31 Comments
  Help Me Urgent!!!         


Author: kaki
Date: May 2, 2008 12:47

1 Comment
  Putting an int value in a char array         


Author: Vlad Dogaru
Date: May 2, 2008 09:21

Hi everyone,

I'm trying to reliably store and read back an int (or short) into/from
a character array. How does one do this in C? I've thought about using
bit shifting and the like in order to put one char at a time, but this
doesn't seem right. Is there something I'm missing? If it's any help,
I'm trying to build a char array to send through a socket.

Thanks,
Vlad
8 Comments
  Fastest way to check variable against two values         


Author: wswilson
Date: May 2, 2008 08:06

In python, I could write:

a = 1

if a in [1, 2]:
do something...

In c (and many other languages):

int a = 1;

if (a == 1 || a == 2) {
do something...
}

Is there a shorter, cleaner syntax?
17 Comments
  printing values of "arrays of pointers"         


Author: arnuld
Date: May 2, 2008 06:34

PURPOSE: see the comments.
WHAT I GOT: infinite loop

/* This program will simply create an array of pointers to integers
* and will fill it with some values while using malloc to create
* pointers to fill the array and then will print the values pointed
* by those pointers
*
*/

#include
#include

enum MAXSIZE { ARRSIZE = 100 };

int main( void )
{
int* arr_p[ARRSIZE];
int** pp;
int *mp, *np;
int i;

int null_int = 0;
Show full article (0.85Kb)
25 Comments
1 2