1. How would you use the functions memcpy(), memset(), memmove()?
Nov 13 '05
71 4241
On Mon, 29 Sep 2003, Mark McIntyre wrote: On 28 Sep 2003 20:08:28 -0700, in comp.lang.c , de**************@rediffmail.com (ROSY) wrote:
r u harlot!!!dont be silly ,ur not at that level atleast.R u meet some plonker except me????
I've no idea what your native tongue is, but that collection of words above is utterly meaningless.
You could try running his gibberish through the program I posted on
Sept. 27'th, though it currently has no support for "d00dsp33k".
-dj
Thomas Matthews wrote: pete wrote: Thomas Matthews wrote:
pete wrote:
Thomas Matthews wrote:
>ROSY wrote: > > > >>1. How would you use the functions memcpy(), >> memset(), memmove()? > >There is also memcmp().
Are you out of your MIND !? OP's question is CLEARLY only about the string functions which return type pointer to void, and which have side effects.
Anyway, the answer to the question is here:
http://anubis.dkuug.dk/jtc1/sc22/wg14/www/docs/n869/
FYI, the mem*() functions are not string functions. The string functions are str*(), and work with NULL terminated character arrays.
Who told you that ?
N869 7.21 String handling <string.h> 7.21.1 String function conventions [#1] The header <string.h> declares one type and several functions, and defines one macro useful for manipulating arrays of character type and other objects treated as arrays of character type. The type is size_t and the macro is NULL (both described in 7.17). Various methods are used for determining the lengths of the arrays, but in all cases a char * or void * argument points to the initial (lowest addressed) character of the array. If an array is accessed beyond the end of an object, the behavior is undefined.
void* arguments have nothing to do with any functions that start with str*.
I'm not correlating a void * with string functions.
*The C Standard* correlates a void* with string functions.
That's my point.
The functions which take void* arguments,
are the string functions which start witm "mem". memcmp() has no side effects, which is part of the reason that memcmp() does not belong in the same group of string functions, as those which OP asked about.
Harbison & Steele, 3rd edition
Thank you for answering my question.
Harbison & Steele, has no authority.
There's always the issue of whether you are trolling or not.
I'm on topic. Now we have learned
that what Harbison & Steele call "Memory Functions",
are what the C standard calls "String functions".
The C standard lumps the functions which start with "mem",
together with the rest of the string functions.
The big difference between "String function" and "Memory function",
is that "String function" is in the C standard
and "Memory function", isn't.
N869
7.21 String handling <string.h>
7.21.1 String function conventions
7.21.2 Copying functions
7.21.2.1 The memcpy function
7.21.2.2 The memmove function
7.21.2.3 The strcpy function
7.21.2.4 The strncpy function
7.21.4 Comparison functions
7.21.4.1 The memcmp function
7.21.4.2 The strcmp function
As you can see, strcpy and memcpy are both "copying functions"
under section 7.21.2, under section 7.21, which is "String handling"
--
pete
Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message I find it amazing how a C coder's competence is usually inversely proportional to his/her usage of "U" and "ur" instead of "you" and "your". Is it written somewhere in stone or is it just a rule of thumb?
And how exactly does that differ from other abbreviations that are
commonly used here - such as IMHO, IIRC, AFAIK, HTH, HAND, etc etc??
Oh yes - they irritate you - therefore the user must be a moron.
>> I personally find it laughable when people spend more time learing d00dsp33k than C programming.
I reckon there's some smart money to be made writing a new language in d00dsp33k.... just think of all the idiots that would buy your compiler, just so as to be up with the rest of the lusers.
Is d00dsp33k anything like California codin'? http://pauillac.inria.fr/~xleroy/stu...rnia-prog.html
;-)
Slartibartfast wrote: Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message
I find it amazing how a C coder's competence is usually inversely proportional to his/her usage of "U" and "ur" instead of "you" and "your". Is it written somewhere in stone or is it just a rule of thumb?
And how exactly does that differ from other abbreviations that are commonly used here - such as IMHO, IIRC, AFAIK, HTH, HAND, etc etc??
Oh yes - they irritate you - therefore the user must be a moron.
These aren't abbreviations, they are acronyms.
"carl mcguire" <ca**********@lineREMOVEMEone.net> wrote in message news:3F**************@lineREMOVEMEone.net... Slartibartfast wrote: Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message
I find it amazing how a C coder's competence is usually inversely proportional to his/her usage of "U" and "ur" instead of "you" and "your". Is it written somewhere in stone or is it just a rule of thumb?
And how exactly does that differ from other abbreviations that are commonly used here - such as IMHO, IIRC, AFAIK, HTH, HAND, etc etc??
Oh yes - they irritate you - therefore the user must be a moron.
These aren't abbreviations, they are acronyms.
And an acronym is :
"An identifier formed from some of the letters (often the initials)
of a phrase and used as an abbreviation" - OED.
Note the word "abbreviation".
--
#include <stdio.h>
char*f="#include <stdio.h>%cchar*f=%c%s%c;%cint main(void){printf(f,10,34,f,34,10,10);return 0;}%c";
int main(void){printf(f,10,34,f,34,10,10);return 0;}
In article <bl**********@coset.qualcomm.com>, Slartibartfast wrote:
[cut] And an acronym is :
"An identifier formed from some of the letters (often the initials) of a phrase and used as an abbreviation" - OED.
Note the word "abbreviation".
Note the word "phrase".
--
Andreas Kähäri ag******@globalnet.co.uk (Slartibartfast) wrote: Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message
I find it amazing how a C coder's competence is usually inversely proportional to his/her usage of "U" and "ur" instead of "you" and "your". Is it written somewhere in stone or is it just a rule of thumb? And how exactly does that differ from other abbreviations that are commonly used here - such as IMHO, IIRC, AFAIK, HTH, HAND, etc etc??
They aren't used by complete illiterates simply because they're too lazy
to learn to spell properly - rather, they're used by (often very)
literate netizens to significantly reduce the space taken by
often-recurring phrases with, essentially, the function of social
lubricant.
Oh yes - they irritate you - therefore the user must be a moron.
No, the general quality of the _rest_ of the text, not to mention the
code, if any is even given, convinces us that the user is a moron. Use
of d00dsp33k is merely a very good indicator of said fact.
Richard
"Richard Bos" wrote on 30 Sept 03: ag******@globalnet.co.uk (Slartibartfast) wrote:
Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message
I find it amazing how a C coder's competence is usually
inversely proportional to his/her usage of "U" and "ur" instead of "you"
and "your". Is it written somewhere in stone or is it just a rule of thumb? And how exactly does that differ from other abbreviations that are commonly used here - such as IMHO, IIRC, AFAIK, HTH, HAND, etc
etc?? They aren't used by complete illiterates simply because they're too
lazy to learn to spell properly - rather, they're used by (often very) literate netizens to significantly reduce the space taken by often-recurring phrases with, essentially, the function of social lubricant.
However, they do make posts harder to read. I'm still new to many of
the acronyms used and I spend more time when reading posts that
contain them trying to figure out what they mean than absorbing the
actual content of the message. Memorising those acronyms can almost
be a prerequisite on this group (and others) in some cases, and that's
a problem in my view. Is it really worth using them for the extra one
or two seconds it would take to type those words in full (the same
goes for many abbreviations, namely d00dsp33k)? I don't believe so.
Not only are they irritating, they can greatly hinder non-English
speakers' comprehension.
End of rant.
Mike
--
Michael Winter
M.Winter@[no-spam]blueyonder.co.uk (remove [no-spam] to reply)
Oh yes - they irritate you - therefore the user must be a moron.
No, the general quality of the _rest_ of the text, not to mention
the code, if any is even given, convinces us that the user is a moron.
Use of d00dsp33k is merely a very good indicator of said fact.
Richard
On 30 Sep 2003 02:22:31 -0700, in comp.lang.c , ag******@globalnet.co.uk (Slartibartfast) wrote: Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message
I find it amazing how a C coder's competence is usually inversely proportional to his/her usage of "U" and "ur" instead of "you" and "your". Is it written somewhere in stone or is it just a rule of thumb? And how exactly does that differ from other abbreviations that are commonly used here - such as IMHO, IIRC, AFAIK, HTH, HAND, etc etc??
The second lot are acronyms for otherwise long and cumbersome phrases.
"u" and "ur" save exactly two bytes each. Wow.
Yes' I've seen your dictionary quote later in the thread. So what?
Oh yes - they irritate you - therefore the user must be a moron.
On the contrary, its an experimental conclusion. A large majority of
those who use SMS-speak or d00dsp33k are also self-evidently lusers.
QED.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
On Tue, 30 Sep 2003 11:41:07 +0200, in comp.lang.c , Grumble
<in*****@kma.eu.org> wrote: Is d00dsp33k anything like California codin'?
http://pauillac.inria.fr/~xleroy/stu...rnia-prog.html
thats pretty funny. And yes..
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
"Mark McIntyre" <ma**********@spamcop.net> wrote in message news:7l********************************@4ax.com... and if you can't be polite, then you should go away.
That disqualifies half the people here, doesn't it.
--
#include <stdio.h>
char*f="#include <stdio.h>%cchar*f=%c%s%c;%cint main(void){printf(f,10,34,f,34,10,10);return 0;}%c";
int main(void){printf(f,10,34,f,34,10,10);return 0;}
"Mark McIntyre" <ma**********@spamcop.net> wrote in message news:p4********************************@4ax.com...
<snip> The second lot are acronyms for otherwise long and cumbersome phrases. "u" and "ur" save exactly two bytes each. Wow.
Joona's point, as well you know, had nothing to do with characters saved.
<snip>
A large majority of those who use SMS-speak or d00dsp33k are also self-evidently lusers.
Please explain the logic underlying that conclusion. You must be personally
acquainted with every SMS user worldwide.
--
#include <stdio.h>
char*f="#include <stdio.h>%cchar*f=%c%s%c;%cint main(void){printf(f,10,34,f,34,10,10);return 0;}%c";
int main(void){printf(f,10,34,f,34,10,10);return 0;}
Slartibartfast <sl******@thhgttg.net> scribbled the following: "Mark McIntyre" <ma**********@spamcop.net> wrote in message news:p4********************************@4ax.com... <snip>
The second lot are acronyms for otherwise long and cumbersome phrases. "u" and "ur" save exactly two bytes each. Wow.
Joona's point, as well you know, had nothing to do with characters saved.
<snip>
A large majority of those who use SMS-speak or d00dsp33k are also self-evidently lusers.
Please explain the logic underlying that conclusion. You must be personally acquainted with every SMS user worldwide.
No he's not. But if we constrain his point to:
A large majority of those who use SMS-speak or d00dsp33k *WHEN WRITING
TO COMP.LANG.C* are also self-evidently lusers,
then by empirical research we can show him to be more-or-less right.
--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"You can pick your friends, you can pick your nose, but you can't pick your
relatives."
- MAD Magazine
In <bl**********@murdoch.hpl.hp.com> Chris Dollin <ke**@hpl.hp.com> writes: Thomas Matthews wrote:
I'm not correlating a void * with string functions. I'm stating that string functions use the NULL character '\0'
Nitpick: NUL, not NULL. Or just the overloaded `null`.
"null" is much better. To someone who is not familiar with the ASCII
three letter abbreviations, "NUL" looks like a mistyped "NULL".
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
On Wed, 1 Oct 2003 10:27:12 +0100, in comp.lang.c , "Slartibartfast"
<sl******@thhgttg.net> wrote: "Mark McIntyre" <ma**********@spamcop.net> wrote in message news:7l********************************@4ax.com...
and if you can't be polite, then you should go away.
That disqualifies half the people here, doesn't it.
there's polite. and there's stupidly impolite.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
On Wed, 1 Oct 2003 10:37:42 +0100, in comp.lang.c , "Slartibartfast"
<sl******@thhgttg.net> wrote: "Mark McIntyre" <ma**********@spamcop.net> wrote in message news:p4********************************@4ax.com...
<snip>
The second lot are acronyms for otherwise long and cumbersome phrases. "u" and "ur" save exactly two bytes each. Wow. Joona's point, as well you know, had nothing to do with characters saved.
I do like interpolations like "as well you know", they're excellent,
as you're undoubtedly very well aware, for diverting attention from
the real point.
<snip>
A large majority of those who use SMS-speak or d00dsp33k are also self-evidently lusers.
Please explain the logic underlying that conclusion. You must be personally acquainted with every SMS user worldwide.
Context dear boy, all is context.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message news:<bl**********@oravannahka.helsinki.fi>... Slartibartfast <sl******@thhgttg.net> scribbled the following:
<snipped> Please explain the logic underlying that conclusion. You must be personally acquainted with every SMS user worldwide.
No he's not. But if we constrain his point to: A large majority of those who use SMS-speak or d00dsp33k *WHEN WRITING TO COMP.LANG.C* are also self-evidently lusers, then by empirical research we can show him to be more-or-less right.
much more "more" than "less", although "less" is not "none". unless
i, with my wanton cruelty to common punctuation, am really a self-
evident luser :-)
goose,
(or should that be g00se ?:-)
> Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message news:<bl**********@oravannahka.helsinki.fi>... Slartibartfast <sl******@thhgttg.net> scribbled the following:
Please explain the logic underlying that conclusion. You must be personally acquainted with every SMS user worldwide.
No he's not. But if we constrain his point to: A large majority of those who use SMS-speak or d00dsp33k *WHEN WRITING TO COMP.LANG.C* are also self-evidently lusers,
Now that bit I'll agree with.
then by empirical research we can show him to be more-or-less right.
Empirical research?? You draw a conclusion about a population of several million people, based on a sample of about three, and you
call that empirical research?? I think you mean wild extrapolation, don't you??
To misquote somebody else's sig: "97.998% of all statistics are made up"
--
#include <stdio.h>
char*f="#include <stdio.h>%cchar*f=%c%s%c;%cint main(void){printf(f,10,34,f,34,10,10);return 0;}%c";
int main(void){printf(f,10,34,f,34,10,10);return 0;}
"ROSY" <de**************@rediffmail.com> wrote in message
news:73**************************@posting.google.c om... again spoking ur nose.
I'm having this vision of a bunch of people
with bicycle wheels attached to their faces. :-)
-Mike
<da***********@yahoo.com> wrote in message
news:a3**************************@posting.google.c om... Default User <fi********@company.com> wrote in message
news:<3F***************@company.com>... ROSY wrote:
Lastly ur really damned.
*plonk*
Brian Rodenborn
I dont know why this OT is such a long one?
Why do circuses attract large audiences?
-Mike This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mac |
last post by:
$ cat junk27.c
#include <stdio.h>
#include <string.h>
int main (void)
{
printf("The difference between memcpy and memmove is %ld\n",
(long int) memcpy - (long int) memmove);
return 0;
}
|
by: Method Man |
last post by:
Just a few theoretical questions I had on 'memmove':
1. Is there ever a good reason to use memcpy instead of memmove?
2. Is memmove useful to copy structs (as opposed to = operator)?
3. In...
|
by: Ian |
last post by:
I read the FAQ about the differences between memcpy() and memmove().
Apparently memmove() is supposed to be safer. Just to make sure I
understand the concept of memmove(), can someone tell me if...
|
by: novice |
last post by:
Please explain with an example whts the
DIFFERENCE between "memcpy" and "memmove"
|
by: wenmang |
last post by:
Here is the code which causes core dump when is built differently, 1
for regular dev built, the other for packaging build.
class my_class{
public:
my_class(){};
~my_class(){};
private:...
|
by: somenath |
last post by:
Hi All,
I am trying to understand the behavior of the memcpy and memmove.
While doing so I wrote a program as mentioned bellow .
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
...
|
by: gsi |
last post by:
Hi all,
memmove() is guranteed to work correctly if the objects overlap, I am not sure why this can't be done without any extra condition check in code for the memmove() implementation or...
|
by: Chris |
last post by:
Hello all,
Not sure if this is off topic, if it is I apologise in advance.
Is it safe to use memmove() on an array of objects?
I create an array of Objects and I have a cursor to indicate...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |