- C भाषा के syntax और semantics को बनाए रखते हुए safety और usability को मजबूत करने वाली एक evolved language है, जो मौजूदा C developers के लिए परिचित environment बनाए रखती है
- पूर्ण C ABI compatibility देती है, इसलिए C/C++ projects में सीधे integrate की जा सकती है, और ऐसा उदाहरण भी है जहाँ vkQuake के कुछ code को C3 में बदलकर
c3c compiler से build किया गया
- module system, operator overloading, compile-time macros आदि के जरिए code structure और expressiveness को बेहतर बनाती है
- contract-based programming (Gradual Contracts), zero-overhead error handling, runtime और compile-time reflection जैसी आधुनिक सुविधाएँ शामिल हैं
- debug mode में safety checks और detailed stack traces अपने-आप मिलते हैं, जिससे bug detection और stability में मदद मिलती है
C3 अवलोकन
- C3 एक programming language है जो C भाषा के syntax और semantics के आधार पर विकसित की गई है
- इसका लक्ष्य है कि मौजूदा C programmers के लिए परिचित रूप बनाए रखते हुए भाषा को आगे बढ़ाया जाए
- सटीक और उद्देश्य-उन्मुख operator overloading को support करती है
- C++ की जटिल overloading structure के बिना vector, matrix, fixed-point arithmetic को स्वाभाविक रूप से व्यक्त किया जा सकता है
- contract-based programming को support करती है, जिससे runtime और compile-time constraints को स्पष्ट रूप से लिखा जा सकता है
- इससे code की stability और specification consistency बेहतर होती है
- Result-based error handling और exception के फायदों को जोड़ती है
- C code के साथ स्वाभाविक रूप से integrate होने वाली error management structure देती है
- type introspection को compile-time और runtime, दोनों में support करती है
- inline assembly: string या जटिल constraints के बिना सामान्य code की तरह assembly लिखी जा सकती है
- debug mode में runtime bound checks और value checks अपने-आप डाले जाते हैं
- C3 standard library debug builds में detailed stack traces डिफ़ॉल्ट रूप से देती है
- साधारण “segmentation fault” की जगह error की सटीक location पता की जा सकती है
Ergonomics and Safety
- Optionals के जरिए error और null handling की safety मिलती है
defer syntax से resource cleanup को automate किया जा सकता है
- slices और foreach से सुरक्षित iteration संभव है
- comment-based contracts से code constraints को स्पष्ट रूप से लिखा जा सकता है
@pool context में memory auto-release को support किया जाता है
Performance by default
- SIMD vectors को सीधे लिखकर hardware-level control संभव है
- अलग-अलग memory allocators चुनकर performance fine-tuning की जा सकती है
- error handling में overhead-free design अपनाया गया है
- तेज compile time और LLVM backend optimization का लाभ मिलता है
- इस्तेमाल में आसान inline assembly दी गई है
Batteries included standard library
- dynamic containers और strings सहित standard data structures उपलब्ध हैं
- cross-platform abstraction के जरिए platform portability सुनिश्चित होती है
- ज़रूरत पड़ने पर native platform access की अनुमति है
Leverage existing C or C++ libraries
- C3 C ABI के साथ पूरी तरह compatible है, इसलिए अलग से “C-compatible types” या function declarations की ज़रूरत नहीं होती
- C3 से C code को link किया जा सकता है, और C से C3 code को भी link किया जा सकता है
Modules are simple
- सरल और सहज module system
- defaults को इस तरह बनाया गया है कि वे development flow में बाधा न डालें
- modules के जरिए namespace management मिलता है
- explicit control के साथ encapsulation structure को सरल बनाया गया है
- interfaces के जरिए shared behavior define किया जा सकता है
- generic modules की सुविधा, जिससे generic types को सरल और स्पष्ट तरीके से implement किया जा सकता है
- struct subtyping के जरिए structure reuse को support किया जाता है
Macros without a PhD
- compile-time macros को सामान्य functions जैसी शैली में लिखा जा सकता है
- code के type information को समझने वाले type-aware macros उपलब्ध हैं
- C preprocessor की तुलना में अधिक स्पष्ट और शक्तिशाली code generation मिलता है
अभी कोई टिप्पणी नहीं है.