yakra / DataProcessing

Data Processing Scripts and Programs for Travel Mapping Project
0 stars 0 forks source link

Don't #include <fstream> or <iostream> in headers. #291

Open yakra opened 3 weeks ago

yakra commented 3 weeks ago

Reduce compile time: Don't #include \<fstream> or \<iostream> in headers.

include \<string> when needed. This can avoid extraneous:

Disassembly of section .text.startup:

0000000000000000 <_GLOBAL__sub_I_datacheck.cpp>:
   0:   50                      push   rax
   1:   bf 00 00 00 00          mov    edi,0x0
   6:   e8 00 00 00 00          call   b <_GLOBAL__sub_I_datacheck.cpp+0xb>
   b:   bf 00 00 00 00          mov    edi,0x0
  10:   be 00 00 00 00          mov    esi,0x0
  15:   ba 00 00 00 00          mov    edx,0x0
  1a:   58                      pop    rax
  1b:   e9 00 00 00 00          jmp    20 <_GLOBAL__sub_I_datacheck.cpp+0x20>

https://stackoverflow.com/questions/31691280/what-does-global-sub-i-mean-in-nm-output#66254512

For forward declarations of fstreams, #include \<iosfwd>. Reddit links here, which links here.

Files: