Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6391229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:38:47+00:00 2026-05-25T03:38:47+00:00

(I defined this program in terms of a C++ program because I faced this

  • 0

(I defined this program in terms of a C++ program because I faced this thing while coding a C++ program, but the actual question is language-agnostic).

I had to copy chars from one char* buffer to another buffer. So, instead of doing a #include <cstring> for strcpy, I wrote a small snippet of code myself to do the same.

Here are the thoughts that I could think of then:

  1. Standard library functions are generally the fastest implementations that one can find of a certain code.
  2. But it would be unwise to include a big header file if you’re going to use only a very minor part of it (that’s what I think happens).

I want to know how right I was in doing so, and what can be defined as a bound of coding own snippets after which one should revert to using headers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:38:48+00:00Added an answer on May 25, 2026 at 3:38 am

    The first rule of thumb is “don’t reinvent the wheel”. And remember that your wheel will probably be worse 🙂 (there are very good programmers that write the wheel provided by your compiler).

    But yes, if I had to include the whole boost library for a single function, I would try to directly copy it from the library 🙂

    I’ll add that the question is marked as “language-agnostic”, so we can’t simply speak about the difference between C/C++ headers and C/C++ libraries. If we speak of a generic language, the inclusion of an external library COULD have side-effects, even BIG side-effects. For example it could slow down very much the startup of your program even if it isn’t used (because it has static initializers that need to be called at startup, or it references flocks of other dll/dynamic libraries that need to be loaded). And it wouldn’t be the first time there is an error in the startup of a program caused by the static startup of one of its dependancies 🙂

    So in the end “it depends”. I would say that if only have to copy up to one file (let’s say 250-500 lines) from a BSD source there isn’t any big problem, for anything bigger linking to the library is probably necessary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason this program is saying that 'switch' is not defined. What is
i'm trying to get this program to break down a user defined amount of
Is this defined by the language? Is there a defined maximum? Is it different
I see variables defined with this type but I don't know where it comes
Is this program well-defined, and if not, why exactly? #include <iostream> #include <new> struct
I know this must be a trivial question, but I've tried many different ways,
I have a model defined this way class Lga < ActiveRecord::Base validates_uniqueness_of :code validates_presence_of
sfGuardUser model of sfDoctrineGuardPlugin is defined this way: sfGuardUser: actAs: [Timestampable] columns: id: type:
I have a web page with swf file defined this way <object width=600 height=400
I have a service which has one endpoint , I have defined this endpoint

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.