Category "constants"

What value does the compiler assign to an uninitialised member of a const struct in C?

Say I have a struct typedef that is: typedef struct { int32_t memberOne; int32_t memberTwo; } myStruct_t; I instantiate a const of that type as follows

c++ Best practise when passing in arguments to functions [closed]

So I have read a lot of things about people saying const & is always good as it eliminates copying, and passing by value is a bad idea. Th

pandas: declare a pandas dataframe as a constant

I would like to declare my dataframe as constant, so no matter what operations are happening in a modeule it's values or column names do not change. I know that

What is the temporal dead zone?

I've heard that accessing let and const values before they are initialized can cause a ReferenceError because of something called the temporal dead zone. What

May a compiler store function-scoped, non-static, const arrays in constant data and avoid per-call initialization?

In reading How are char arrays / strings stored in binary files (C/C++)?, I was thinking about the various ways in which the raw string involved, "Nancy", would

RISC-V build 32-bit constants with LUI and ADDI

LUI (load upper immediate) is used to build 32-bit constants and uses the U-type format. LUI places the U-immediate value in the top 20 bits of the destinati

Find address of constant in go

We have written one program by which we try to find an address of a constant. Is it possible to do it like that? package main func main() { const k =

const& , & and && specifiers for member functions in C++

Recently I was reading through the API of boost::optional and came across the lines: T const& operator *() const& ; T& operator *() & ; T

Swift: Global constant naming convention?

In Swift, it seems that global constants should be camelCase. For example: let maximumNumberOfLoginAttempts = 10 Is that correct? I'm used to all caps, e.g

Removal of constant columns in R

I was using the prcomp function when I received this error Error in prcomp.default(x, ...) : cannot rescale a constant/zero column to unit variance I know I

What's the difference between constexpr and const?

What's the difference between constexpr and const? When can I use only one of them? When can I use both and how should I choose one?

const vs constexpr on variables

Is there a difference between the following definitions? const double PI = 3.141592653589793; constexpr double PI = 3.141592653589793; If not, which styl

Declare a constant array

I have tried: const ascii = "abcdefghijklmnopqrstuvwxyz" const letter_goodness []float32 = { .0817,.0149,.0278,.0425,.1270,.0223,.0202, .0609,.0697,.0015,.0077

Why does const have to be added to constexpr for a string literal declaration?

This declaration: char constexpr *const s = "hello"; Fails with this error: g++ -g -Wall -Werror -std=c++17 test.cc -o test test.cc:8:31: error: ISO C++11 d

Proper implementation of global configuration

My goal is to have global constants in a C++ game I'm working on (to represent some graphics info and the like). My current implementation is to toss them all i

What is a constant reference? (not a reference to a constant)

Why do constant references not behave the same way as constant pointers, so that I can actually change the object they are pointing to? They really seem like an

phpDoc class constants documentation

How do I document class constants for phpDoc? I've read the manual but I can't find anything about them.

phpDoc class constants documentation

How do I document class constants for phpDoc? I've read the manual but I can't find anything about them.

Disable check of camel case rule in eslint

I have a large JavaScript file with multiple eslint rule violations. I am trying to disable them and address them one at a time. The code below shows that I can

Why Is `Export Default Const` invalid?

I see that the following is fine: const Tab = connect( mapState, mapDispatch )( Tabs ); export default Tab; However, this is incorrect: export default const