Re: Receiving a boolean from an InputBuffer ?

From: Gary G. Little (gglittle.nospam_at_sbcglobal.net)
Date: 01/06/05


Date: Thu, 06 Jan 2005 18:10:44 GMT

O my goo'ness O, how many times can one person shoot themselves in the foot?
First you got petulant and then you show your ignorance.
Of course memcpy et al are functions defined in an Application Programmers
Interface (API for short). You get access to them, like any well behaved API
by including the proper header file that has the prototypes imported.

Try using memcpy or even strcpy in a source module without using ANY
includes in the source. This is a rather dumb, but apro po, test, but like
any API, to use it you have to include the proper header that imports the
desired functions, and write the functions as defined by the function
prototypes, which did not in the example below.

Surely you do not equate memcpy to "switch"? If so, how in the hell did you
pass C Programming 101?!?!?!?

////////////////////////////////////////////////////////////////////////////
/////////////////
//
// Is memcpy or is NOT memcpy an API

void main (void)

{
 char *buf[256];

 memcpy(buf, &buf[128], 128);
 fwrite();
 strcpy();
 return;
}

-- 
The personal opinion of
Gary G. Little
<o> wrote in message news:%2399GLT28EHA.824@TK2MSFTNGP11.phx.gbl...
>
> "Larry Brasfield" <donotspam_larry_brasfield@hotmail.com> wrote in message
> news:e43ghB18EHA.1392@tk2msftngp13.phx.gbl...
> > > "Larry Brasfield" <donotspam_larry_brasfield@hotmail.com> wrote in
> message
> > > news:OI6vqvy8EHA.4028@TK2MSFTNGP15.phx.gbl...
> > >> Two things wrong here:
> > >> 1. Your question is not about the kernel or kernel programming.
> > >>   Hence it is off-topic here.
> > >>
> > >> 2. If 'InputBuffer' refers to an object of type void *, then
> > >>  *InputBuffer is not an evaluatable expression.  Casting
> > >>   it does no good.
> > >>
> > >> Perhaps you mean to write:
> > >>    reply= *((BOOL *)InputBuffer);
> > >> or, better yet in C++
> > >>    reply = *reinterpret_cast<BOOL *>(InputBuffer);
> >
> > > Two things...
> > > First, if it's off topic why r u answering?
> >
> > Because newbies need to learn about topicality and because you
> > appeared to need the assistance, both on that and the question.
> >
> > > 2. DeviceIoControl is very much related to this ng. You may say,
> > > go and learn api programming first, but this particular api is the
> > > only one which uses void pointers as input/output. Show me another
> > > api that uses input/output buffers which are void, and I say you will
> > > not find.
> >
> > A great many interfaces use void * for passing buffers of
> > unspecified content.  Lookup memset() and memcpy().
> > Or fwrite() and fread().  Or countless others.
>
> Once again you are not accurate, memcpy/fwrite/fread
> are not api's, they are C run-time functions.
>


Relevant Pages

  • [md-accel PATCH 04/19] async_tx: add the async_tx api
    ... The async_tx api provides methods for describing a chain of asynchronous ... channel pool is organized as a per-cpu array of channel pointers. ... * under the terms and conditions of the GNU General Public License, ... +static void ...
    (Linux-Kernel)
  • [2.6 patch] removing bcopy... because its half broken
    ... Nothing in the kernel is using bcopy right know, and that is a good thing. ... the userspace standard bcopyis basically a memmove() with a weird ... explicit memcpy() and memmoveare prefered anyway ... -void bcopy ...
    (Linux-Kernel)
  • Re: Proposed addition of malloc_size_np()
    ... Consider that the allocator must know how large allocations are so that it can do the right thing for reallocand free. ... Following is a much more reasonable API that doesn't burden the allocator with information that the application should be able to provide: ... this isn't about reinventing a perfect wheel -- it's about filing off a rough edge on the stone wheel we're stuck with. ...
    (freebsd-arch)
  • [PATCH 11/14/] Doc. sources: expose hpet
    ... the rtc.c driver. ... There is a user space API and a kernel space API. ... -static void ...
    (Linux-Kernel)
  • Re: Help with Date and SimpleDateFormat
    ... > void applyLocalizedPattern ... Try browsing through the API docs for some classes that have only ... In a case where an API library method throws an unexplainable exception, ...
    (comp.lang.java.programmer)