Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
purist12167yLook into some kernel headers..bro..When u look into that , you may understand why it makes sense sometimes..By the way ..in those ppl use macro constants..
-
inb4 constexpr values
Names usually just make more sense than some seemingly random number -
spacem18447yNot sure why not?
Lately I use const for everything except for loops which need to be let of course. -
PRein11877yI have a bunch of those and it's completely justified. I use them as 'settings' that can't directly be used in the code so they go in another constant that is later used many times.
-
7Raiden8787yWell it depends. If you have something like
int one = 1;
double y = x + one;
Then ok, it makes no sense! But if it is a sort of configurable parameter, or something like Math.Pi / 2 (I'm thinking about some trigonometric applications), then why not? It certainly improves readability! -
Awlex182757y@7Raiden
More like the first case.
Schema='https'
Hoster='some hoster'
Api_destination= Schema + '://' + Hoster
(Sry about the uppercase varnames, but typing code on phone is a pain)
👋DON'T👋MAKE👋CONSTANTS👋IF👋YOU👋ONLY👋USE👋THEM👋ONCE👋TO👋CREATE👋ANOTHER👋CONSTANT👋
undefined