|
|
Up |
|
|
  |
Author: oopsatworkoopsatwork
Date: Feb 19, 2008 15:22
Ok...so, I have been outside of the C world for a _very_ long
time...but not so long as to remember how to do multidimensional
arrays. So, let me state that I know how to malloc pointers to
pointers and then malloc my data space. This question is NOT about
that.
I need to keep a dynamically sized (a result of command line options)
matrix in a shared memory segment created via shmget and attached via
shmat. My first instinct was to do what I would do if I were using
malloc. However, the docs for shm.h tell me that it is not safe to
share my pointers, as the shared memory may be attached at a different
point on different processes. So, my question is, whether or not
there is a "standard", or at least common, way of doing shared
multidimensional arrays. I could always "simulate" a multidimensional
array in a single dim. array, but that seems less than ideal. Any
thoughts?
Thanks,
-mike
|
| |
|
| |
2 Comments |
|
  |
Author: thomasthomas
Date: Feb 19, 2008 11:55
hello I m writing a simple parser using bison. I just used someone's else
c++ grammar, to produce a code beutifier. The thing is , most of the actions
for productions would have form
{$$ = $1 + $2 + $3} and so forth depending on number of terminals in
production. Is it possible to set default action for all the productions
like the one above ? It is something strange to type this formula for over
200 productions.
|
| |
|
| |
7 Comments |
|
  |
Author: johnnashjohnnash
Date: Feb 19, 2008 09:22
typedef astruct
{
int x;
} A;
struct b
{
A a;
}B;
struct b *C;
C = &B;
so if i want to access say B.a.x, and if i am going to use the
pointer notation(using C), then is it right to say -
1. (C->a).x
2. (*C).a.x
|
| |
|
10 Comments |
|
  |
Author: bobbybobby
Date: Feb 19, 2008 07:58
hi group,
Does the header file size or number in include(s) effect the size of
executable file?
In other world if i chose a large header file and include it with my
source file does it increase the size of the executable outcome at the
end?
thanks
|
| |
|
7 Comments |
|
  |
Author: johnnashjohnnash
Date: Feb 19, 2008 07:33
I saw this particular piece of code in a book which basically adds two
vectors and produces the sum
Vector *VectorAdd( Vector *a, Vector *b, Vector *c)
{
c->x = a->x + b->x ;
c->y = a->y + b->y ;
c->z = a->z + b->z;
return(c);
}
Now my doubt about this code is why did the author decide to return
the address of c ? Is it not true that when we pass values by
reference, then there is no need to return anything as changes are
automatically reflected at the address of the variable ?
|
| |
|
8 Comments |
|
  |
Author: splspl
Date: Feb 19, 2008 04:38
I have an array of objects. I want to sort the array of a
given numeric value that exists in each of the objects. Suppose the
array of objects is called student and the numeric value I want to
sort the array based on the member is called "rollno".
ex:
struct student{
int rollno;
int name;
int status;
};
student obj[10]
here, I have to sort obj of 10objects, based on rollno.
Please give your suggestion for any fast method?
|
| |
|
6 Comments |
|
  |
Author: Nick KeighleyNick Keighley
Date: Feb 19, 2008 02:23
On 18 Feb, 18:59, "Bill Cunningham" nspam.com> wrote:
> Â Â I have written this file and decided to try error checking
but you failed to check if the fopen() calls succeeded
> and eof
> checking and there must be a bug somewhere.
you suffer from the illusion that EOF is an error.
> It compiled with djgpp fine. It
> takes the win32/pe assembler as.exe and writes it to a.exe. I hope it's not
> too hard to read.
your layout is horrid
> I'm stumped but that's expected and nothing new.
in later posts you ask how to copy a file and don't
seem to understand the answer.
in pcode:
LOOP UNTIL NO MORE DATA
read;
write;
END
|
| Show full article (2.13Kb) |
|
6 Comments |
|
  |
Author: raseelbhagatraseelbhagat
Date: Feb 19, 2008 01:06
Hi,
I am planning to replace the gethostbyname() blocking call with the
asynchronous library routines , i.e., libcares.
But, before I do that, how do I go about testing the blocking call ,
and subsequently on replacing with libcares routines, the
asynchronousity (i know ,it;s not even a word)
Thanks,
Raseel
http://www.raseel.in/techblog
|
| |
|
2 Comments |
|
  |
|
|
  |
Author: aarklonaarklon
Date: Feb 19, 2008 00:39
Hi all,
recently a friend asked me is there any dynamic binding in C...??
to which i answered AFAIK it is in C++ only,
but he says it is valid in C.
if dynamic can be implemented via function pointers in C ,
can anyone give an example for dynamic binding in C...??
|
| |
|
4 Comments |
|
|
|
|