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
  Shootout (sum-file)         


Author: Razik
Date: May 5, 2008 21:23

On Wed, 30 Apr 2008 08:00:38 -0700 (PDT), Isaac Gouy
yahoo.com> wrote:
>Why don't you go through all...

Let's continue. Next we deal with sum-file...

http://shootout.alioth.debian.org/gp4/benchmark.php?test=sumcol&lang=all#about

"Programs should use built-in line-oriented I/O functions rather than
custom-code. No line will exceed 128 characters, including newline.
Reading one line at a time, the programs should run in constant
space."

According to Haskel people,

"Those guys tell us these benchmarks don't favor C and then impose a
limit on line length? What's the purpose of that if not to allow the
use of C's getline() primitive?"

That's a valid point that you need to address. Why 128 characters
limit if not to help C and C++ guys?

In any case,
C++
http://shootout.alioth.debian.org/debian/benchmark.php?test=sumcol&lang=gpp&id=2
Show full article (1.23Kb)
46 Comments
  Pointer question...last for the day? :-)         


Author: mdh
Date: May 5, 2008 19:52

One thing has puzzled me a while ( well, more than one thing!).

If I have a function:

foo( char *s){

char *t = s;

.....

s++; <<--- a few arbitrary times

}

Now...my question is this.

Is "t" independent of s, in the sense of:

1) Will it still point to the beginning of s, after s++ ?

2) I guess related to 1, if I now evaluate *t, will it be the first
character in s?

Thanks...that's it for today!!!
17 Comments
  Allocate Static Memory?         


Author: Bryan Parkoff
Date: May 5, 2008 19:50

I want to know how much static memory is limited before execution
program starts. I would write a large array. The large array has 65,536
elements. The data size is double word. The static memory would allocate
256K. The 256K is a fixed memory size. After the compiler has completed
compiling header and source code, the execution program might fail to run or
crash. The operating system might do not display error message saying,
"Insufficient memory."
The dynamic memory may be the option. The malloc() function can test to
determine if allocated memory is available at run-time. Then, use I/O like
fopen() and fclose() functions to read data from the hard drive and store it
into RAM. The error message can display at run-time if malloc() tests to
tell insufficient memory...
Show full article (0.94Kb)
11 Comments
  C and OpenMP         


Author: Renato Perini
Date: May 5, 2008 16:08

Hi all!!!
I'm trying to find a *good* book about OpenMP and C, but I can't find
anything specific. Can you advice me some good (and updated) books about
OpenMP using the C interface? I'd like a book that covers everything
from the ground up. Thank you in advance.
6 Comments
  Rusty's message to C++ programmers (C or C++)         


Author: Raz
Date: May 5, 2008 15:24

On Wed, 30 Apr 2008 21:54:37 GMT, Erik Wikströ
>Obviously his knowledge of C++ is not as good as it should be.

As I said, I will find the link again. His knowledge of C++ is just
fine.

http://www.builderau.com.au/video/soa/Rusty-s-message-to-C-programmers/0,2000064338...

http://www.builderau.com.au/video/soa/Why-C-remains-relevant/0,2000064338,22432921p...

So here is an expert of who believes that you don't need C++ to
program low level. C++ brings extra complexity that is not needed. C
is #1 language to program in lower level. We can also add that you
don't need C++ to program in higher level either, as you can use
easier and better languages such as C#, Java, Ruby on Ralis, Perl,
Python.
24 Comments
  When you declare an array of chars and store a string in it, where is the position of the null character \0? And what happens to the unused memory locations?         


Author: Gary
Date: May 5, 2008 15:04

When you declare an array of chars and store a string in it, where is
the position of the null character \0? And what happens to the unused
memory locations?

#include
int main(void)
{
char gstring2[25] = "dudes";
gstring2[5] = 'a';
printf("%%s \n", gstring2);
return 0;
}

The output of main function was

dudesa

How come this code works, and the statement
gstring2[5] = 'a';
doesn't overwrite the null character?
8 Comments
  Problem with SYS_mount         


Author: Sam Joseph
Date: May 5, 2008 14:14

Hello,

I need to mount a loopback file system. I'm using SYS_mount, but it
always fails with ENOTDIR. Am I doing something silly? Here's the
offending line:

if(syscall(SYS_mount,
"/home/sam/mnt/", "/home/sam/myfile.img", "-o loop" ))
perror("Mount failure/ ");

Thanks.
28 Comments
  strcpy question         


Author: mdh
Date: May 5, 2008 11:19

I have a question about the library function strcpy.
In K&R on page 109, strcpy is used to copy a line ( line[] ) to a
pointer (char *), which is first allocated space by K&Rs "alloc"
function.
In a few pages prior to this, the example that K&R showed used this
definition for it's version of strcpy

void strcpy( char *s, char *t){

while ( *s++ = *t++);

}

Could someone help me understand the library function, which,
according to the appendix, returns the target string.
So, in this case, what is passed to the library is an array-the
original string and a pointer to the target string? What happens if
the target pointer has not been allocated space? And, is this
acceptable ie to pass a pointer instead of an actual char array for
the target string?

tks
16 Comments
  How is it working? Am I doing it right?         


Author: Benoit Lefebvre
Date: May 5, 2008 08:54

Weird subject you will say.. I didn't know what to put in there..

Long story short, I'm changing the value of a variable from a
function.. Nothing unusual there..

How come the value of the "word" variable change when using the
testfunct function? Am I sending a pointer to the word variable to
this function or whatever ??

I know it's a weird question.. especially that this is doing exactly
what I need.. but I want to know if I'm doing it right and if not, how
to make it work correctly.

The program where this is going is checking a configuration text file
and puts all the lines in a 2d char array for comparison later. Here
is a simplified "extraction" of the code.

------
#include
#include

int testfunct (char *myword)
{
strcpy(myword,"hello");
Show full article (0.99Kb)
4 Comments
  For Sale: Premodded Video Game Consoles, Games & Retro Stuff         


Author: glow4
Date: May 5, 2008 06:26

We’re a video game specialist and wholesaler for modded consoles,
retro consoles and game backups, we ship worldwide. Below are some of
our offerings at wholesale prices. For any enquiries, please feel free
to contact us at gamersparadisemy@gmail.com

Sony Playstation 3 - 40GB Pack (NTSC/U & NTSC/J versions available)
comes with two dual shock 3 controllers and Hori cooling fan.
USD 350 (with worldwide shipping)

XBOX 360 Elite (with HDMI)
– 120GB Pack (NTSC/U & NTSC/J) comes with two controllers and Nyko
cooling fan.
Modded and able to run XBOX 360 backups, homebrew softwares and able
to go online via XBOX Live.
USD 400 (with worldwide shipping)
Show full article (3.13Kb)
no comments
 
1 2