Sponsored Content
Top Forums Programming pass a pointer-to-pointer, or return a pointer? Post 302273849 by steephen on Tuesday 6th of January 2009 01:49:42 AM
Old 01-06-2009
Why are you using the function in this scenario? By using function calls you are creating the overhead of function call and temporaray object.
 

10 More Discussions You Might Find Interesting

1. Programming

pointer

void main() { int a={1,2,3,4,5,6,7,8,9,10}; int *p=a; int *q=&a; cout<<q-p+1<<endl; } The output is 10, how? if we give cout<<q it will print the address, value won't print.... if we give cout<<p it will print the address, value won't print.... p has the base addr; q... (1 Reply)
Discussion started by: sarwan
1 Replies

2. Programming

Regarding char Pointer

Hi, char *s="yamaha"; cout<<s<<endl; int *p; int i=10; p=&i; cout<<p<<endl; 1) For the 1st "cout" we will get "yamaha" as output. That is we are getting "content of the address" for cout<<s. 2) But for integer "cout<<p" we are getting the "address only". Please clarify how we are... (2 Replies)
Discussion started by: sweta
2 Replies

3. Programming

pointer problem

could any one tell why the following is showing segmentation fault while using **ptr but working fine using **a #include<stdio.h> ... (1 Reply)
Discussion started by: useless79
1 Replies

4. Programming

far pointer

what is far pointer in C (1 Reply)
Discussion started by: useless79
1 Replies

5. Programming

How to return void function pointer

Hello all im trying to build function that will return void function pointer what is mean is ( not working ) the main function void * myClass::getFunction(int type){ if(type==1) return &myClass::Test1; if(type==2) return &myClass::Test2; } void myClass::Test1(){... (1 Reply)
Discussion started by: umen
1 Replies

6. Programming

matrix pointer

Can anyone tell me what the following statements do? float (*tab); tab=(float (*)) calloc(MAXCLASS, (MAXCLASS+1)*sizeof(float)); (3 Replies)
Discussion started by: littleboyblu
3 Replies

7. Programming

Pointer Arithmetic In C

I have a fundamental question on C pointer arithmetry.. Suppose i have a c string pointer already pointing to a valid location, Can I just do a charptr = charptr +1; to get to the next location, irregardless if my program is 32 or 64 bits? or should i do it this way: charptr =... (1 Reply)
Discussion started by: Leion
1 Replies

8. Programming

Pointer to pointers

Hi guys, I'm trying to understand pointers in C and made a simple example and I've problems with It. Can someone help? #include <stdio.h> #include <stdlib.h> #include <assert.h> int f1(char **str_); int main(int argc, char **argv) { char *str = NULL; f1(&str); ... (3 Replies)
Discussion started by: pharaoh
3 Replies

9. Programming

Pointer for 2D array seems to be 3D in C

I am struggling with the pointer to 2D-array (cf: 2D array of pointers). Can anybody help me elaborate how the pointer x moves in the memory to access the individual of y, especially the high lighted lines? I have talked to one of the curators of the forum, but I am still not quite clear. Here... (1 Reply)
Discussion started by: yifangt
1 Replies

10. Programming

Segmentation fault when I pass a char pointer to a function in C.

I am passing a char* to the function "reverse" and when I execute it with gdb I get: Program received signal SIGSEGV, Segmentation fault. 0x000000000040083b in reverse (s=0x400b2b "hello") at pointersExample.c:72 72 *q = *p; Attached is the source code. I do not understand why... (9 Replies)
Discussion started by: jose_spain
9 Replies
iv_event_raw(3) 					    ivykis programmer's manual						   iv_event_raw(3)

NAME
IV_EVENT_RAW_INIT, iv_event_raw_register, iv_event_raw_unregister, iv_event_raw_post - manage ivykis objects for event notification SYNOPSIS
#include <iv_event_raw.h> struct iv_event_raw { void *cookie; void (*handler)(void *); }; void IV_EVENT_RAW_INIT(struct iv_event_raw *this); int iv_event_raw_register(struct iv_event_raw *this); void iv_event_raw_unregister(struct iv_event_raw *this); void iv_event_raw_post(struct iv_event_raw *this); DESCRIPTION
iv_event_raw provides a way for delivering events to ivykis(3) recipients across thread and process boundaries. The intended event recipient calls IV_EVENT_RAW_INIT on a struct iv_event_raw object, fills in ->cookie and ->handler, and then calls iv_event_raw_register on the object. To generate an event, call iv_event_raw_post on the previously initialized struct iv_event_raw object. This will cause the callback speci- fied by ->handler to be called in the thread that the struct iv_event_raw object was registered in, with ->cookie as its sole argument. To deinitialize a struct iv_event_raw object, call iv_event_raw_unregister from the same thread that iv_event_raw_register was called from on that object. It is permitted to unregister a struct iv_event_raw object from any ivykis callback function in the thread it was registered in, including from a callback function triggered by this object, and it is permitted to free the memory corresponding to an unregistered object from its own callback function. iv_event_raw_post can be called from the same thread that iv_event_raw_register was called from, from a different thread in the same process, or even from a different process, and can safely be called from signal handlers. If posting an event only ever needs to be done from within the same process, see iv_event(3) for a lighter-weight alternative to iv_event_raw. Internally, iv_event_raw is implemented by registering a file descriptor (a struct iv_fd(3)) with the recipient thread's ivykis event loop, and by causing that file descriptor to become readable upon a call to iv_event_raw_post. If eventfd(2) is available, it will be used to procure the abovementioned file descriptor. If not, iv_event_raw will fall back to pipe(2) as the source of its file descriptors. eventfd(2) is preferred as it requires only one file descriptor table entry (while pipe(2) requires two), and has much less kernel overhead than pipe(2) has. SEE ALSO
ivykis(3), iv_event(3), eventfd(2), pipe(2) ivykis 2010-09-02 iv_event_raw(3)
All times are GMT -4. The time now is 02:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy