Menu

Black for C++: what if your indentation was your syntax tree?
πŸ“°

Black for C++: what if your indentation was your syntax tree?

DEV Community: cppΒ·Johnny WezelΒ·7 days ago
#q2qZZOxs
#devtocpp#devto#dev#if#else
Long article (1924 words) β€” no AI summary yet.
Reading 0:00
15s threshold

I recently wrote a line of C++ that took me three passes to read. It was not clever code. It was an ordinary constructor initializer list.

Display :: Display ( Keyboard & keyboard , int output , const Vector & position , const Vector & size , const Vector & expandTo , Screen screen ) : keyboard_ ( keyboard ) , output_ { output } , screen_ { screen } , cursor_ ( enter ( position ) ) , terminalSize_ { terminalSize ( ) } , foreground_ { RgbWhite } , background_ { RgbNone } , attributes_ { } , position_ { screen == Screen :: alternate ? Vector { 0 , 0 } : position == VectorMin ? cursor_ : position } , maxSize_ { min ( expandTo == VectorMax ? terminalSize_ : expandTo , screen == Screen :: alternate ? terminalSize_ : Vector { toDim ( terminalSize_ . x ( ) - position_ . x ( ) ) , terminalSize_ . y ( ) } ) } , text_ ( Null , size == VectorMin ? Vector { 1 , 1 } : min ( size , maxSize_ ) ) { cursor ( false ) ; makeRoom ( text_ . height ( ) ) ; keyboard .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.