The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-08-2008
Registered User
 

Join Date: Nov 2007
Posts: 73
q on memmove()

Besides syntax-related issues, is there anything else I should be aware of when using memmove() ? If misued, can it create runtime errors ?
Reply With Quote
Forum Sponsor
  #2  
Old 07-09-2008
Registered User
 

Join Date: Oct 2007
Location: USA
Posts: 568
Segmentation Violation

memove() operates on byte strings so make sure to check for bounds (on the destination array) otherwise the process terminates with SIGSEGV at runtime.
Reply With Quote
  #3  
Old 07-09-2008
Registered User
 

Join Date: Jun 2008
Posts: 19
Performance.

If you are sure that buffer are not overlapped, you should use memcpy, becuase it's faster
Reply With Quote
  #4  
Old 07-18-2008
Registered User
 

Join Date: Apr 2006
Location: Northern Virginia
Posts: 23
I would recommend that the writer look into bcopy() and bzero(). If memory serves, they are the original primitives, and thus the most efficient. In the C++ world, string objects help protect the programmer from [him|her]self and tend the details. Certainly this is at the cost of efficiency, but then these days performance is a balance to reuse in the application programming space.

I am sorry to say that there are many environments where the management doesn't want anything but scripting tools like bash/csh/perl/php because they can't afford programmers who know C and C++. Their words, not mine, by the way. So then what I used to think of as prototyping tools now become what is used in production. That means that the security review must include not only software but also the underlying interpreter.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:39 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0