- Re: named pipes
- Posted by Jerry Coffin on September 14th, 2003
In article <cvvoOCEkDEU$Iwc1@grandfathersaxe.demon.co.uk>,
steve@grandfathersaxe.demon.co.uk says...
[ ... ]
Not so -- it thinks you're declaring a function named CreateNamedPipe.
Again, not really -- this is attempting to declare a function named
CreateNamedPipe that takes no parameters and returns a HANDLE. Assuming
you've included windows.h (which declares CreateNamedPipe to take 8
parameters) you'll get an error from the compiler saying the
declarations conflict with each other.
Fortunately, the cure you've given is correct anyway -- use something
like:
Handle pipeHandle = CreateNamedPipe(...);
and all is well.
--
Later,
Jerry.
The universe is a figment of its own imagination.
- Posted by SteveR on September 14th, 2003
Jerry Coffin <jcoffin@taeus.com> writes:
Given that the "declaration" passes numbers and a string instead of type
names, I'm right. See below.
To declare it as taking no parameters, I would have had to say:
HANDLE CreateNamedPipe( void );
^^^^ note void not NULL
or:
HANDLE CreateNamedPipe();
To declare a function, the tokens between the () must be named or
unnamed parameter specifications, as in the following:
HANDLE CreateNamedPipe( int );
HANDLE CreateNamedPipe( int pipenum );
HANDLE CreateNamedPipe( int (*)() (*func)(int i, char c, float) );
(last is "pointer to function taking int, char, float and returning
pointer to function taking no parameters and returning int.")
Since NULL is a constant typically #defined as ((void *)0), it can't be
a parameter specification.
In that case, we fall back to a constructor-syntax initialiser, which
works just fine with C++ primitive data types (integers, floating point,
pointers). These are equivalent:
HANDLE h(NULL);
HANDLE h = NULL;
In plain C, the first would be an error, but as this is in a class, I
feel safe in allowing C++ syntax.
--
SteveR
- Posted by Jerry Coffin on September 14th, 2003
In article <$4bQLLCBCCZ$IwwQ@grandfathersaxe.demon.co.uk>,
steve@grandfathersaxe.demon.co.uk says...
[ ... ]
Absolutely true -- clearly I should have been in bed instead of posting
at 1:30 AM...
--
Later,
Jerry.
The universe is a figment of its own imagination.
- Delay when using Named Pipes in Windows XP (Networking) by Macadro
- How to use named pipes? (Programming) by Ramon F Herrera
- Re: named pipes (Development Resources) by Ritchie
- Windows XP - are named pipes much slower? (Development Resources) by Stephen Kellett
- Named pipes question (Development Resources) by Vladimir Beker

