Home New Trending Search
About Privacy Terms
#
#const
Posts tagged #const on Bluesky
Post image

10 mil posts publicados.
17 anos e 2 meses sem interromper a narrativa.

Não foi sobre viralizar.
Foi sobre permanecer.

A luneta continua apontada para longe.
E o próximo ciclo começa agora.

#10MilVezesLuneta #JosivandroAvelar #ConstânciaCriativa #ArteCidadeComunicação #ProduçãoDeConteúdo

0 0 0 0
Preview
Constantes tipadas en Go Introducción En un artículo anterior conocimos las constantes en Go y vimos cómo representan valores fijos evaluados en tiempo de compilación. De forma intencionada, en ese articulo no entré en el pap...

Tras explicar qúe son las constantes en Go y los tipos de datos que ofrece el lenguaje, llega el momento de unir ambos conceptos. En este artículo veremos cómo Go vincula constantes y tipos de datos.

www.lateclaescape.com/post/2026/go...

#LaTeclaESC #golang #const

0 0 0 0
Preview
Constantes en Go Introducción En el artículo anterior vimos qué son las variables en Go. Sin embargo, en un programa en Go, no todos los valores deben ser variables. Para representar valores fijos, inmutables y conoci...

Este articulo explica qué son las constantes en Go, cómo se declaran y en qué situaciones aportan claridad y seguridad al código.

www.lateclaescape.com/post/2026/go...

#LaTeclaESC #golang #const

0 0 0 0
Preview
Hamilton police warned about officer's support of white nationalists 8 months before they suspended him | CBC News In August, Hamilton police suspended an officer while they investigated “disturbing” social media posts. Meanwhile, a local anti-racism group says it informed police last year of a person with extremi...

#Canada
#Hamilton #PoliceService (HPS) said they #suspended #Const. #Renato #Greco
while they investigated his public support for #white #nationalist #groups - calling for a #coup.

www.cbc.ca/news/canada/...

0 0 0 0
Preview
John Roberts: "I Never Thought the Leopards Would Eat *My* Judiciary" The chief justice who handed an oligarch a crown is once again surprised by the consequences of his own actions

#JohnRoberts: "I Never Thought the #Leopards Would Eat *My* #Judiciary". The #chief #justice who handed an #oligarch a crown is once again surprised by the consequences of his own actions by Allison Gill #democracy #const...
#usa #gop #fascists #fascism

👉 Vote 'em Out!

0 0 0 0
Preview
C++ what is the consteval? How is it different to const and constexpr? ## C++: What is `consteval`? How is it Different from `const` and `constexpr`? If you’ve been using `const` and `constexpr` in your C++ code, you might be wondering what the new `consteval` keyword in C++20 brings to the table. Let’s break it down clearly. ### What is `consteval`? The `consteval` specifier declares a function as an **immediatefunction**, meaning the function _must_ be evaluated at compile time. Unlike `constexpr`, which allows both compile-time and runtime evaluation, `consteval` enforces compile-time only. 1 2 3 | consteval int square(int x) {     return x * x; } ---|--- consteval int square(int x) { return x * x; } Any attempt to call this function with non-constant input (or at runtime) will cause a compile-time error. ### Example 1 2 3 4 5 6 7 8 9 | consteval int add(int a, int b) {     return a + b; } int main() {     constexpr int result = add(2, 3);  // OK     int x = 5;     // int y = add(x, 3);  // ERROR: add must be evaluated at compile time } ---|--- consteval int add(int a, int b) { return a + b; } int main() { constexpr int result = add(2, 3); // OK int x = 5; // int y = add(x, 3); // ERROR: add must be evaluated at compile time } ### Comparison Table Feature | `const` | `constexpr` | `consteval` ---|---|---|--- Introduced in | Pre-C++11 | C++11 | C++20 Purpose | Make variables read-only | Allow compile-time evaluation | Require compile-time evaluation Used on | Variables | Variables, functions, constructors | Functions only Runtime execution? | Yes | Maybe | No Compile-time guarantee? | No | Optional | Yes (mandatory) ### When Should You Use `consteval`? * When you want 100% guarantee that a function runs only at compile time. * For validating inputs during compile-time metaprogramming. * To prevent any accidental runtime overhead. ### Advanced Use: Compile-Time String Length 1 2 3 4 5 6 7 | consteval std::size_t const_strlen(const char* str) {     std::size_t len = 0;     while (str[len] != '\0') ++len;     return len; } constexpr auto len = const_strlen("Hello");  // OK ---|--- consteval std::size_t const_strlen(const char* str) { std::size_t len = 0; while (str[len] != '\0') ++len; return len; } constexpr auto len = const_strlen("Hello"); // OK ### Summary `consteval` is a powerful addition to C++ for strict compile-time enforcement. Use it when `constexpr` isn’t strict enough, and you want full control over compile-time behavior. #### C/C++ Programming * C++ What is the consteval? How is it different to const and constexpr? * Tutorial on C++ std::move (Transfer Ownership) * const vs constexpr in C++ * Tutorial on C++ Ranges * Tutorial on C++ Smart Pointers * Tutorial on C++ Future, Async and Promise * The Memory Manager in C/C++: Heap vs Stack * The String Memory Comparision Function memcmp() in C/C++ * Modern C++ Language Features * Comparisions of push_back() and emplace_back() in C++ std::vector * C++ Coding Reference: is_sorted_until() and is_sorted() * C++ Coding Reference: iota() Setting Incrementing Values to Arrays or Vectors * C++ Coding Reference: next_permutation() and prev_permutation() * C++ Coding Reference: count() and count_if() * C++ Code Reference: std::accumulate() and Examples * C++ Coding Reference: sort() and stable_sort() * The Next Permutation Algorithm in C++ std::next_permutation() –EOF (The Ultimate Computing & Technology Blog) — **GD Star Rating** _a WordPress rating system_ 480 words **Last Post** : Tutorial on C++ std::move (Transfer Ownership) The Permanent URL is: C++ what is the consteval? How is it different to const and constexpr? (**AMP Version**) ### Related posts: 1. Comparisions of push_back and emplace_back in C++ std::vector In C++, both push_back and emplace_back are methods of the std::vector class used to add... 2. Tutorial on C++ Ranges C++20 introduced ranges, a powerful and elegant abstraction for working with sequences (like arrays, vectors,... 3. const vs constexpr in C++ C++ const vs constexpr: What’s the Real Difference? Both are used in C++ to define... 4. Tutorial on C++ std::move (Transfer Ownership) 📘 C++ Move Semantics & std::move() Tutorial C++ std::move() is used to transfer the ownership... 5. Tutorial on C++ Smart Pointers Tutorial on Smart Pointers in C++ Smart pointers in C++ provide automatic and safe memory... 6. Teaching Kids Programming – Delete Nodes From Linked List Present in Array Teaching Kids Programming: Videos on Data Structures and Algorithms You are given an array of... 7. From Idea to GitHub Pages: Building Tools with AI and Vibe Coding Built and Open-Sourced 3 Mini Tools with AI Recently, I used ChatGPT-4o and o4-mini to... 8. Interview Coding Exercise – Nested String (Python) Nested String A string S consisting of N characters is considered to be properly nested...

C++ what is the consteval? How is it different to const and constexpr? C++: What is consteval? Ho...

helloacm.com/c-what-is-the-consteval-...

#c #/ #c++ #c++ #C++ #11 #C++ #20 #const #const #keywords

Result Details

0 0 0 0
Preview
const vs constexpr in C++ ## C++ `const` vs `constexpr`: What’s the Real Difference? Both are used in C++ to define constants. ### Why This Matters Modern C++ encourages writing immutable, efficient, and expressive code. Two keywords—`const` and `constexpr`—sit at the heart of that effort. They look similar, but understanding their distinct guarantees is crucial for clean compile‑time and run‑time behavior. #### High‑Level Comparison Feature | `const` | `constexpr` ---|---|--- Compile‑time constant? | Maybe | Always (or fails to compile) Runtime OK? | Yes | Yes (evaluated at runtime if needed) Array/template usage | Only if truly constant | Guaranteed Functions allowed? | Only qualifiers on member | Full functions evaluable at CT ### 1 Declaring Immutable Data #### `const`: Immutable After Construction 1 | const int runtimeConst = std::rand(); // const but NOT a compile‑time constant ---|--- const int runtimeConst = std::rand(); // const but NOT a compile‑time constant When you merely want to prohibit modification—regardless of when the value is known—`const` is enough. #### `constexpr`: Must Be Known at Compile Time 1 2 | constexpr int arraySize = 10; int arr[arraySize];           // Always valid ---|--- constexpr int arraySize = 10; int arr[arraySize]; // Always valid If the value must participate in contexts that require a constant expression (array bounds, template parameters, `switch` labels), choose `constexpr`. ### 2 Functions and Methods #### `const` Member Functions 1 2 3 4 | class Widget { public:     int value() const {/*…*/} // promises not to modify *this }; ---|--- class Widget { public: int value() const {/*…*/} // promises not to modify *this }; They protect object state but offer no compile‑time guarantee. #### `constexpr` Functions 1 2 3 | constexpr int square(int n) { return n * n; } static_assert(square(4) == 16, "computed at compile time"); ---|--- constexpr int square(int n) { return n * n; } static_assert(square(4) == 16, "computed at compile time"); A `constexpr` function can run during compilation whenever its arguments are constant expressions, yet it still works at run time. ### 3 Common Pitfalls 1 2 3 4 5 | // 1. Compiles: runtimeConst is merely const const int runtimeConst = std::rand(); // 2. Fails: std::rand() is not constexpr constexpr int fails = std::rand(); ---|--- // 1. Compiles: runtimeConst is merely const const int runtimeConst = std::rand(); // 2. Fails: std::rand() is not constexpr constexpr int fails = std::rand(); Remember: every `constexpr` variable is implicitly `const`, but not every `const` variable is a constant expression. ### 4 Guidelines for Choosing * Need guaranteed compile‑time evaluation? Use `constexpr`. * Need immutability but value might come from a run‑time calculation? Use `const`. * Prefer `constexpr` if unsure; the compiler will complain if the initializer isn’t a constant expression. ### 5 Summary Snippet 1 2 | constexpr int ctVal = 42; // compile‑time const int rtVal = std::rand(); // run‑time, still immutable ---|--- constexpr int ctVal = 42; // compile‑time const int rtVal = std::rand(); // run‑time, still immutable Choosing correctly between `const` and `constexpr` unlocks safer, faster, and more expressive C++ code. Default to `constexpr` for constants you truly want at compile time, and reserve `const` for values determined during execution. #### C/C++ Programming * const vs constexpr in C++ * Tutorial on C++ Ranges * Tutorial on C++ Smart Pointers * Tutorial on C++ Future, Async and Promise * The Memory Manager in C/C++: Heap vs Stack * The String Memory Comparision Function memcmp() in C/C++ * Modern C++ Language Features * Comparisions of push_back() and emplace_back() in C++ std::vector * C++ Coding Reference: is_sorted_until() and is_sorted() * C++ Coding Reference: iota() Setting Incrementing Values to Arrays or Vectors * C++ Coding Reference: next_permutation() and prev_permutation() * C++ Coding Reference: count() and count_if() * C++ Code Reference: std::accumulate() and Examples * C++ Coding Reference: sort() and stable_sort() * The Next Permutation Algorithm in C++ std::next_permutation() –EOF (The Ultimate Computing & Technology Blog) — **GD Star Rating** _loading..._ 623 words **Last Post** : Tutorial on C++ Ranges The Permanent URL is: const vs constexpr in C++ (**AMP Version**) ### Related posts: 1. Comparisions of push_back and emplace_back in C++ std::vector In C++, both push_back and emplace_back are methods of the std::vector class used to add... 2. Tutorial on C++ Smart Pointers Tutorial on Smart Pointers in C++ Smart pointers in C++ provide automatic and safe memory... 3. Tutorial on C++ Ranges C++20 introduced ranges, a powerful and elegant abstraction for working with sequences (like arrays, vectors,... 4. From Idea to GitHub Pages: Building Tools with AI and Vibe Coding Built and Open-Sourced 3 Mini Tools with AI Recently, I used ChatGPT-4o and o4-mini to... 5. Teaching Kids Programming – Delete Nodes From Linked List Present in Array Teaching Kids Programming: Videos on Data Structures and Algorithms You are given an array of... 6. Interview Coding Exercise – Nested String (Python) Nested String A string S consisting of N characters is considered to be properly nested... 7. The Computers at Early 2000s In 2003, I took the college entrance exam and then spent the summer in Beijing.... 8. Using BackTracking Algorithm to Find the Combination Integer Sum Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find...

const vs constexpr in C++ C++ const vs constexpr: What’s the Real Difference? Both are used in ...

https://helloacm.com/const-vs-constexpr-in-c/

#c #/ #c++ #C/C++ #programming #languages #tutorial #c++ #const #constexpr #programming

Result Details

0 0 0 0

PBS deals with bothsidesism, WE, already know the other side, and we are tired of it! NEWS is just data, one has to choose what seems reasonable & true (does it follow the #Const). If it doesn't, more than likely it's propaganda.
#IAmPoliticsGirl #KeithOlbermann
#AOC #HouseDemWomen #digby56

0 0 0 0
Preview
Announcing Rust 1.83.0 | Rust Blog Empowering everyone to build reliable and efficient software.

🦀🦀🦀 1.83.0
New #Rust with new #Const is here + other changes

blog.rust-lang.org/2024/11/28/R...

0 0 0 0
Post image

Aula da linguagem JavaScript: Diferença entre var, let e const
#JavaScript #programadores #bolhatech #fundamentos #JS #var #let #const

5 2 0 0
Pictures of Kevin Powell (right) & Chris Ferdinandi (left) with cyan text on blue rounded borders rectangles in dark green blue with gradient violet magenta background: var let const.
Overlaid white text: explained.
Gradient violet magenta background.

Pictures of Kevin Powell (right) & Chris Ferdinandi (left) with cyan text on blue rounded borders rectangles in dark green blue with gradient violet magenta background: var let const. Overlaid white text: explained. Gradient violet magenta background.

🟪🟥 JavaScript var, let, and const explained
by Kevin Powell @KevinJPowell
Feat.: Chris Ferdinandi @ChrisFerdinandi @cferdinandi@mastodon.social
#js #var #let #const #webdev #coding

www.youtube.com/watch?v=pobW...

0 0 0 0
Preview
Writing better Reducers with React and Typescript 3.4 Leveraging state reducers and immutability at scale can be tricky. Nonetheless the incredible arsenal of tools we have to handle that, it…

Writing better Reducers with React and Typescript 3.4 by @mschettinoo#javascript #typescript #const #assertions

medium.com/p/writing-bett…

0 0 0 0

indexPath, always indexPath, never index(<#const char *#>, <#int#>), Xcode.

0 0 1 1