Config Router

  • Google Sheets
  • CCNA Online training
    • CCNA
  • CISCO Lab Guides
    • CCNA Security Lab Manual With Solutions
    • CCNP Route Lab Manual with Solutions
    • CCNP Switch Lab Manual with Solutions
  • Juniper
  • Linux
  • DevOps Tutorials
  • Python Array
You are here: Home / Is #include bad practice?

Is #include bad practice?

August 19, 2021 by James Palmer

Msdn documentation explicitly tells you (a) in which header file a function is declared and (b) which header file you are supposed to include.
Most functions tell you to include windows.h, for example SendMessage
Some function, that were added later or have very specific use cases, are only available through other header files, for example SetupDiEnumDeviceInfo.
So no, it is not bad practice to follow their advice. However, I strongly recommend disabling some parts of it before including via macro, e.g.
#define NOMINMAX
#include

because otherwise you will get a min and a max macro that will interfere with std::min and std::max.

bits/stdc++.h is a compiler-specific header. If you compile your code with a different compiler it may or may not exist. It’s not part of standard C++. It’s a shortcut for access to the C++ standard library.
windows.h is an operating-system specific header. If you’re compiling for Windows you need it, and every compiler that supports Windows will be okay with it. It doesn’t necessarily come with the compiler; it comes with the Windows Software Development Kit. It provides access to the Windows API.
You might be able fine-tune your #include directives under Windows, but Windows is such a mess that unless you really want to spend time digging into it, you’re better off just using windows.h.

Related

Filed Under: Uncategorized

Recent Posts

  • How do I give user access to Jenkins?
  • What is docker volume command?
  • What is the date format in Unix?
  • What is the difference between ARG and ENV Docker?
  • What is rsync command Linux?
  • How to Add Music to Snapchat 2021 Android? | How to Search, Add, Share Songs on Snapchat Story?
  • How to Enable Snapchat Notifications for Android & iPhone? | Steps to Turn on Snapchat Bitmoji Notification
  • Easy Methods to Fix Snapchat Camera Not Working Black Screen Issue | Reasons & Troubleshooting Tips to Solve Snapchat Camera Problems
  • Detailed Procedure for How to Update Snapchat on iOS 14 for Free
  • What is Snapchat Spotlight Feature? How to Make a Spotlight on Snapchat?
  • Snapchat Hack Tutorial 2021: Can I hack a Snapchat Account without them knowing?

Copyright © 2025 · News Pro Theme on Genesis Framework · WordPress · Log in