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
-
jmclemo66787y@Bitwise I think you missed the point of it being as convoluted as possible on purpose. :-P
-
jmclemo66787y@Julien00859 if I saw that in a code base I would immediately shorten it. Vertical space / conciseness is a precious / important thing and that is wasting way too much of it.
-
jmclemo66787y@Julien00859 oh I get it now that you mention it. 😅 I guess even when I'm trying to be convoluted there are just certain things that I can't bring myself to do.
-
JS96184557y@Julien00859
bool answer;
if (s[s.length -1] == '0')
{
answer = true;
return (answer == true);
}
else if (s[s.length -1] != '0')
{
answer = true;
return (answer != true || answer == false);
}
Now it's clear. -
The ONLY correct way to get the last element from std string is:
std::string s = "Hello" ;
char c= *((&s.at(0)) + (s.size() - 1));
I've seen people posting their own convoluted ways to find out whether or not a number is even, so here's mine. :-P
undefined
is it even
i hate modulus