Hi,

And we had another day of many learnings, and building blocks for our
Hackathon on Friday!

Thank you Saifi and thank you folks who joined in!

Here's the summary from today's session:

-----

triplet linux-glibc-gcc x86_64 (AMD64)

Why do you we need modules in general in C++?

analysing #include statement:
g++ -E <filename>.cc > log

This would generate a long log from the pre-processor

The issue here is the C pre-processor works before the C++ compiler comes in, 
what the pre-processor does is verbatim substitution or the macro hackery.

stages:
pre-processing
|
v
compiling
|
v
linking

We looked at why Macros are considered evil.

Multiple includes
Compilation
Linking

C++ modules are compiled and they have their own link, which means, Module 
linking.

A full fleged Database, just casually beats elasticsearch in latency and QPS.
https://github.com/infiniflow/infinity

Written in C++ and using c++ modules.

C++ focus from  day 1  has been exceptionally high performance.


The problematic thing is Cmake!

30 years of headers files, it's not going to go away. Because c++ has a very 
clear cut mandate is to maintain backward compatibility. C++ maintains HU, and 
the translation unit becomes a MU (module unit).

It supports both headers as header units and modules.

When working with a module unit you can #include header or import HU along with 
importing a module.

import is a keyword and not a pre-processor directive like #include, and can 
only be directly compiled.

import can only be used with option -fmodules-ts when  compiling the .cc file.

This is a command to create a header unit:
g++ -fmodules-ts -fmodule-only -c -x c++-system-header iostream

PCH : Pre-compiled headers

Our community would use the below triplet:
linux-glibc-gcc

Demir project helps us achieve that.

References:
https://vitaut.net/posts/2024/faster-cpp-compile-times/
https://sourceforge.net/projects/softwarefreedom/files/gcc/
https://stackoverflow.com/questions/318398/why-does-c-compilation-take-so-long

-----

Please note that the screenshots from the session would be posted on the
meetup group.

Warm regards
Ragini.

Reply via email to