linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ron Michael Khu <ronkhu@ntsp.nec.co.jp>
To: Scott <drmemory@3rivers.net>, linux-c-programming@vger.kernel.org
Subject: Re: Into the Void
Date: Wed, 26 Jan 2005 10:18:46 +0800	[thread overview]
Message-ID: <41F6FE06.7020001@hq.ntsp.nec.co.jp> (raw)
In-Reply-To: <20050126000910.GC888@drmemory.local>

why dont u try casting the whole thing??
(putting an enclosing parenthesis on ur memcpy oper)

((char *) memcpy(*data_buf,bp,len))[len] = '\0';


Scott wrote:

>Years ago, I learned this trick from somebody in the C/C++ Journal, or
>whatever that rag was called:
>
>           memcpy(*data_buf,bp,len)[len] = '\0';
>
>I get the following error:
>
>indatax.c: In function `read_datum':
>indatax.c:374: warning: dereferencing `void *' pointer
>indatax.c:374: invalid use of void expression
>
>and if I cast the function:
>
>           (char *) memcpy(*data_buf,bp,len)[len] = '\0';
>
>I get:
>
>indatax.c: In function `read_datum':
>indatax.c:374: warning: dereferencing `void *' pointer
>indatax.c:374: void value not ignored as it ought to be
>
>What aren't I understanding here? Tell me to go away if these
>questions are too elementary for the list....
>-
>To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
>  
>



  reply	other threads:[~2005-01-26  2:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-26  0:09 Into the Void Scott
2005-01-26  2:18 ` Ron Michael Khu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-01-26 13:45 Jeff.Fellin
2005-01-26 16:11 ` Scott
2005-01-27  4:02   ` Ron Michael Khu
2005-01-27 17:01     ` Scott
2005-01-26 16:02 Huber, George K RDECOM CERDEC STCD SRI
2005-01-27 17:58 Huber, George K RDECOM CERDEC STCD SRI
2005-01-28  4:36 ` Amit Dang
2005-02-01 15:32 Huber, George K RDECOM CERDEC STCD SRI
2005-02-02 12:15 ` Glynn Clements
2005-02-02 18:17 Huber, George K RDECOM CERDEC STCD SRI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41F6FE06.7020001@hq.ntsp.nec.co.jp \
    --to=ronkhu@ntsp.nec.co.jp \
    --cc=drmemory@3rivers.net \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).