From: Don Dugger <n0ano@n0ano.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] Re: memcpy failure
Date: Thu, 14 Nov 2002 15:10:08 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590709805427@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590709805424@msgid-missing>
I sometimes prefer a routine to return a pointer, even if the
pointer is known in advance. This way you can set a pointer
in the same statement that does the copy, e.g.:
ptr = memcpy(malloc(100), buffer, 100);
rather than:
ptr = malloc(100);
memcpy(ptr, buffer, 100);
This is just a stylistic issue, I like to remove lines of code
whenever possible.
PS: I would never actually do this code example, using a malloc
without checking the result is wrong, but you get the idea.
On Thu, Nov 14, 2002 at 10:01:44AM +0100, Christian Cotte-Barrot wrote:
> "Chen, Kenneth W" wrote:
> >
> > The retrun value for memcpy doesn't follow the user space memcpy exactly.
> > kernel memcpy always return 0.
> > - Ken
> >
>
> But memcpy from memcpy.S is returning a pointer to dest area.
> That would lead to quasi non-portable code when the return from memcopy
> is correctly checked depending on which memcopy function is addressed.
> But BTW, is it meaningful to take into account a return code
> that is always the same and which value is known in advance ?
> Does memcpy suppose to failed in some cases ?
>
> _______________________________________________
> Linux-IA64 mailing list
> Linux-IA64@linuxia64.org
> http://lists.linuxia64.org/lists/listinfo/linux-ia64
--
Don Dugger
"Censeo Toto nos in Kansa esse decisse." - D. Gale
n0ano@n0ano.com
next prev parent reply other threads:[~2002-11-14 15:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-14 9:01 [Linux-ia64] Re: memcpy failure Christian Cotte-Barrot
2002-11-14 12:23 ` Matthew Wilcox
2002-11-14 15:10 ` Don Dugger [this message]
2002-11-14 15:47 ` [Linux-ia64] " Chen, Kenneth W
2002-11-14 15:53 ` [Linux-ia64] " Chen, Kenneth W
2002-11-14 16:09 ` Mario Smarduch
2002-11-14 16:12 ` Matthew Wilcox
2002-11-14 19:21 ` Mario Smarduch
2002-11-14 19:37 ` David Mosberger
2002-11-14 20:32 ` Chen, Kenneth W
2002-11-15 10:32 ` Christian Cotte-Barrot
2002-11-15 13:04 ` Matthew Wilcox
2002-11-15 13:51 ` Christian Cotte-Barrot
2002-11-15 14:17 ` Matthew Wilcox
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=marc-linux-ia64-105590709805427@msgid-missing \
--to=n0ano@n0ano.com \
--cc=linux-ia64@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.