TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

C++ tricks

6 pointsby wojciemalmost 10 years ago

2 comments

stinosalmost 10 years ago
&#x27;tricks&#x27; indeed. Don&#x27;t get me wrong, if one is still stuck in the pre-C++-11 era this could open a lot of gates into unexplored yet exciting new territory and it does provide reasonable code samples, yet I wouldn&#x27;t recommend this for learning C++ as it also introduces some bad habits. For example<p>- in 1 all variable declarations and initializations are split. That seems to stem from pre-C99 and makes no sense, especially not when they are on consecutive lines anyway.<p>- 3 &#x27;simply use #include &lt;bits&#x2F;stdc++.h&gt;&#x27; No, don&#x27;t do that. Instead properly learn what each header is for. Moreover it&#x27;s not even a standard header so non-portable.<p>- 4 &#x27;hidden functions&#x27; Again non-portable and doesn&#x27;t have much to do with c++ anyway<p>- &#x27;&quot; \n&quot;[j == m]&#x27; yes that&#x27;s a trick to have save one line of code at the expense of being hard to understand and way more error prone<p>- &#x27;#define mt make_tuple&#x27; why would you obscure your code like that by saving 8 or so characters
anotherangrydevalmost 10 years ago
&gt;#include &lt;bits&#x2F;stdc++.h&gt;<p>This is a very cool trick to turn your compile time from seconds to minutes.