473,836 Members | 2,240 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

memcpy() vs. for() performance

#define SIZE 100
#define USE_MEMCPY

int main(void)
{
char a[SIZE];
char b[SIZE];
int n;

/* code 'filling' a[] */

#ifdef USE_MEMCPY
memcpy(b, a, sizeof(a));
#else
for (n = 0; n < sizeof(a); n++)
{
b[n] = a[n];
}
#endif
}

/*
Any (general) ideas about when (depending on SIZE) to use
memcpy(), and when to use for()?

<OT>
Any remarks about this issue using GCC, or the Sun compiler,
are welcome.
</OT>
*/

Nov 14 '05
33 33773
Case - <no@no.no> wrote in message news:<40******* *************** @dreader2.news. tiscali.nl>...
Humour is in the eye of the beholder.


Would that be vitreous humor or aqueous humor :-)
Nov 14 '05 #31
re********@yaho o.com (red floyd) writes:
Case - <no@no.no> wrote in message
news:<40******* *************** @dreader2.news. tiscali.nl>...
Humour is in the eye of the beholder.


Would that be vitreous humor or aqueous humor :-)


checking for [OT] tag ... ok

Yes, the eye certainly lens itself to puns. But enough of this
ocularity. If the jokes get any cornea, I'll give you 40 lashes.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #32
Dan Pop wrote:
In <40************ **********@drea der2.news.tisca li.nl> Case - <no@no.no> writes:

Dan Pop wrote:

In <40************ ***********@new s.xs4all.nl> Case <no@no.no> writes:

Yep, one other good reason to always use memcpy(). However, how was
the saying again .... "Never say always!" :-)
Another failed attempt at humour...


Humour is in the eye of the beholder.

Only when a large enough number of beholders perceive it as such.


No, on the contrary! Needing only the personal (i.e.,
individual) observation, is at the heart of the original
'beholder-saying'.

Case

Nov 14 '05 #33
In <40************ **********@drea der2.news.tisca li.nl> Case - <no@no.no> writes:
Dan Pop wrote:
In <40************ **********@drea der2.news.tisca li.nl> Case - <no@no.no> writes:

Dan Pop wrote:
In <40************ ***********@new s.xs4all.nl> Case <no@no.no> writes:

>Yep, one other good reason to always use memcpy(). However, how was
>the saying again .... "Never say always!" :-)
Another failed attempt at humour...

Humour is in the eye of the beholder.

Only when a large enough number of beholders perceive it as such.


No, on the contrary! Needing only the personal (i.e.,
individual) observation, is at the heart of the original
'beholder-saying'.


Which is why it doesn't apply to humour ;-)

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #34

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
17521
by: franky.backeljauw | last post by:
Hello, following my question on "std::copy versus pointer copy versus member copy", I had some doubts on the function memcpy, as was used by tom_usenet in his reply. - Is this a c++ standard library function? That is, can I be sure that every c++ standard library has this function? Or is there a c++ alternative to it?
5
1424
by: PeterCMG | last post by:
I am currently working on creating guidelines for designing client/server applications for performance. I am looking for any existing documentation that would assist with this and my google searches have not produced much. Please let me know if you are aware of any good sites or other resources that would cover guidelines for better performing client/server applications (especially in a Microsoft world). Thanks, Peter
0
1259
by: Bryan Parkoff | last post by:
I use Intel C++ Compiler 8.1 for my Xeon Pentium III 550MHz machine. I have executed six different tests for performance. GV stands for global variable. GF stands for global function. SV stands for struct variable or class variable. SF stands for struct member function or class member function. JMP stands for switch (xx). CALL stands for pointer to function. My output screen test shows that GV GF and SV GF have almost the same...
2
2396
by: Stan Leung | last post by:
Hello all, I am interested in know if anyone has set up clustering for performance and fail over using PostgreSQL. We are currently using Oracle for a distribution application and would like to use PostgreSQL with multiple application and database servers. Regards Stan. --------------------------------- Post your free ad now! Yahoo! Canada Personals
0
9657
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10532
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10577
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10241
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9359
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5812
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4443
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.