[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: c++.png (70 KB, 1152x325)
70 KB
70 KB PNG
C++ eternally BTFO
https://www.youtube.com/watch?v=7fGB-hjc2Gc
>>
File: 1756395659839921.png (250 KB, 718x588)
250 KB
250 KB PNG
>>107837821
There are definitely worse lingos I came across ...
>>
>>107837821
This is just bitching about shit not being easy for beginners
>>
>>107838097
not really. for example header files are plain retarded and will never not be retarded.
>>
What's a better alternative to C++?
>>
>>107838263
There isn't any. C++ is a terrible language but there is no better language in its domain.
>>
>>107838263
D
>>
>>107837821
TL;DW
>>
>>107838332
C++ is the worst programming language of all time
>>
>>107838126
How do other compiled languages link functions between files?
Do they just make a global symbol table off the definitions?
Honest question
>>
>>107837821
I like the laissez-faire philosophy of c++
there's no official compiler
no official package manager
no enforced code formatting
no official community Discord server
and usually many ways of achieving the same goal, some more optimal than others but can suit different styles of programming.
>>
>>107838332
c++ sucks ass, hard, many reason given
c++ still will be used and wont die, reasons given
>>
>>107838511

To answer your question simply: Yes, they essentially create a global symbol table, but no, they don't just dump the raw function names into it (except for C).
Most compiled languages (C++, Rust, Go, Swift, D) compile source files into Object Files (like .o or .obj). These object files contain a mini-symbol table. The Linker then combines these into one massive list to resolve connections.
Here is the breakdown of how this works and how modern languages improve upon the old C model.
1. The Universal Mechanism: "Provided" vs. "Required"
regardless of the language, almost all compiled languages generate object files that contain two specific lists:
Exports (Definitions): "I have a function named X located at memory offset 0x123."
Imports (Undefined References): "I am trying to call a function named Y, but I don't know where it is."
The Linker is a program that reads all the object files, finds the "Exports" from one file, and plugs them into the "Imports" of another.
2. The Problem: The "Flat" Namespace
In C, if you write void init() in File A and void init() in File B, the linker will crash with a "Duplicate Symbol" error. This is because C uses the raw name. The global symbol table is "flat."
How C handles it:
You have to manually prefix functions: audio_init, video_init.
You use the static keyword to tell the compiler: "Do not put this name in the global symbol table; keep it private to this file."
3. How Other Languages Handle It (Name Mangling)
Modern languages (C++, Rust, Swift) allow you to have a function named init in ten different files without a collision. They do this by lying to the linker about the function's name. This is called Name Mangling (Symbol Decoration).
They encode the namespace, the module, and sometimes the function signature directly into the name string that goes into the global symbol table.
>>
>>107838511
C: Uses raw names. Rely on the programmer to make names unique or hide them with static.
C++: Uses Mangling. Encodes the class name and argument types into the symbol string.
Rust/Swift: Uses Heavy Mangling. Encodes the package/crate name, module path, and a hash into the symbol string.
Go: Prefixes the Package path.
>>
>>107838263
C.
>>
>>107838263
C
>>
>>107838263
>What's a better alternative to C++?
properly using C++

also possibly C++2 by Herb
>>
>>107837821
Bold claim when C# and dotnet exist



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.