Comments (10)
static constexpr char s[] = "Hello";
from calculator.
This is your friendly Microsoft Issue Bot. I created this issue automatically as requested by a team member.
from calculator.
What exactly do you mean by strings? const char* s ="Helllo";
is a compiletime constant. std::string on the other hand can't be made constexpr anyway.
from calculator.
Ideally, we move to this as standard for our string constants.
constexpr auto s = L"Hello";
from calculator.
Nothing against it but is there any difference between that and const auto s = L"Hello" ?
Just curious.
from calculator.
Nothing against it but is there any difference between that and const auto s = L"Hello" ?
Just curious.
L"Hello"
L Marks that the string will be always widechar.
from calculator.
Thanks, but my question was not about L""
vs ""
, but constexpr auto s = L"Hello"
vs const auto s = L"Hello"
.
from calculator.
Thanks, but my question was not about
L""
vs""
, butconstexpr auto s = L"Hello"
vsconst auto s = L"Hello"
.
I believe the only difference is that the constexpr
version is available for use with other constexpr
expressions during compilation, whereas the const
form is not created until static are initialized at runtime.
from calculator.
Im pretty confident that the the "normal" const version will not cause initialization at run-time. But you are probably right about use in constexpr expressions - I haven't tried top use "nornal" global const variables in quite some time now. That's why I was asking.
from calculator.
I think you're right, see the doc on constant initialization.
In practice, constant initialization is performed at compile time, and pre-calculated object representations are stored as part of the program image (e.g. in the .data section). If a variable is both const and constant-initialized, its object representation may be stored in a read-only section of the program image (e.g. the .rodata section)
So is this issue even needed or should we close it? Right now I would say this is low priority and falls into the bucket of general codebase improvement/best-practices.
from calculator.
Related Issues (20)
- How to remove fucking spaces from this calculator or return to windows 7 verison. HOT 2
- space
- Wrong result in the win 11 calculator HOT 2
- Calculator Does Not Support Multiplying By Negative Numbers
- Using '%' in Standard Calculator Clears Input HOT 1
- Multiple Currency Conversion
- Calculator crashes if you zoom to far out on the Graphing Page
- Ja
- Ja
- [Localization]
- SWIPE DELETE FUNCTION FREEZES APP
- Wrong icon of calculator
- Disable scientific notation
- Programmer calculator treats MSB as sign bit, no option to remove sign bit
- Can you set a button for the top function in all (scientific) modes
- Is it possible to add an option that allows you to restore the history even after closing the application and opening it again? HOT 1
- "about equal to" feature in the volume calculator/converter
- Constant ratio of units on the axes
- [Localization] [zh-CN] Incorrect translations in Currency
- Disabling the Clipboard User Service causes Calculator to crash when copying values or pressing CTRL+C
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from calculator.