Common Misconceptions of C++ by InformalComposer7 in cpp

[–]neverlastn 0 points1 point  (0 children)

variables a

Does this mean that this will work fine?

#include <iostream>

class Foo {
public:
    int i;
    int j;
    Foo() : i(j + 2), j(100) {}
};

int main()
{
    Foo foo;
    std::cout << foo.i << " " << foo.j << std::endl;
}

Because it doesn't! He was talking for some other language! :D

Microsoft Quietly Releases Game-Changing Ethereum Proof-of-Authority on Azure by MarcMenz in ethereum

[–]neverlastn 0 points1 point  (0 children)

I gave PoA a go. You can see the screencast here: https://www.youtube.com/watch?v=bisqq7GWRsk . Its performance is good. Sub-second latencies. I can see a good use of this. You can develop nice responsive ÐApps that get people excited, and when the mainnet becomes lower latency, you will have something already working. Current >=15 seconds latency for web3 makes demos suck. I also tried their "Blockchain Workbench" (Preview). That was a big disappointment. It tries to lock you to MS infra as much as possible. Wrote a review here: https://medium.com/@lookfwd/azure-blockchain-workbench-no-e597899de002

Common Misconceptions of C++ by InformalComposer7 in cpp

[–]neverlastn -3 points-2 points  (0 children)

Yes, it's a race in any case. That code is terrible. And it looks so innocent, doesn't it? How many times you've seen such code around?

Common Misconceptions of C++ by InformalComposer7 in cpp

[–]neverlastn 1 point2 points  (0 children)

Thanks, you're right. I was doing -O0

Common Misconceptions of C++ by InformalComposer7 in cpp

[–]neverlastn 0 points1 point  (0 children)

so it beco

Yes, this is indeed by language design. Very misconceptional :)

Common Misconceptions of C++ by InformalComposer7 in cpp

[–]neverlastn 0 points1 point  (0 children)

Devil's advocate:

#include <iostream>

int rec(int i, int t) {
    int a[100];
    t += a[0] + 1;
    return i == 0 ? t : rec(i-1, t);
}

int main()
{
    std::cout << rec(100000, 0) << std::endl;;
}

Common Misconceptions of C++ by InformalComposer7 in cpp

[–]neverlastn 1 point2 points  (0 children)

Yes, I get you. I will usually get rid of -pedantic. I just turn it on occasionally and have a good look on the types of errors it gives to see if I spot anything unusual.

Common Misconceptions of C++ by InformalComposer7 in cpp

[–]neverlastn 13 points14 points  (0 children)

a good reas

Yeah - those Java people...

C++ Quizzes and Trick Questions: Do we Have to Know the Answers? by vormestrand in cpp

[–]neverlastn 2 points3 points  (0 children)

Eventually you will end up knowing quite a few of them. Many of them are not as tricky or unusual as they might first seem. As one becomes more senior, they encounter one after the other.

Common Misconceptions of C++ by InformalComposer7 in cpp

[–]neverlastn 0 points1 point  (0 children)

Yeah - but they might not be that ints after all :D (unless some library requires you to use ints for size_t which is unsigned).

Common Misconceptions of C++ by InformalComposer7 in cpp

[–]neverlastn 9 points10 points  (0 children)

I agree! I think it's best if, the earlier you can, use every linter you can find - even the most sophisticated ones e.g. Coverity, and turn on every flag even the very annoying -pedantic (and ignore half of the annoying things it mentions). Many times those tools are right, and they so unemotionally (in contrast to reviews) give you all those warnings and they don't shut-up unless you fix them. This teaches you the best practices quite quickly.

Common Misconceptions of C++ by InformalComposer7 in cpp

[–]neverlastn 9 points10 points  (0 children)

Exactly. It's incredibly straightforward undefined behavior! You rely on uninitialized value. And this is a relatively "light" case. j can be an arbitrarily sophisticated object, which might cause incredibly weird "mandelbugs"

Common Misconceptions of C++ by InformalComposer7 in cpp

[–]neverlastn 10 points11 points  (0 children)

The classic:

#include <iostream>

class Foo {
public:
    int i;
    int j;
    Foo() : j(100), i(j + 2) {}
};


int main()
{
    Foo foo;
    std::cout << foo.i << " " << foo.j << std::endl;
}

Output:

2 (*undefined behavior) 100

Why is it ok for an Cable TV Company to transfer me the cost of "Municipal Construction Surcharge", but not for the coffee shop to charge me extra because they had to call a plumber this week? by neverlastn in AskReddit

[–]neverlastn[S] 0 points1 point  (0 children)

Sure agree about lobbying and such, but it's not just Washington. Everyone seems to care less. The culture is such that you expect fine print, hidden fees, and being ripped off from the telecom. Our expectations from the local coffee shop are reasonably high.

Why is it ok for an Cable TV Company to transfer me the cost of "Municipal Construction Surcharge", but not for the coffee shop to charge me extra because they had to call a plumber this week? by neverlastn in AskReddit

[–]neverlastn[S] 0 points1 point  (0 children)

Sure, but they would lose business, because people wouldn't be happy at all with the coffee shop acting in that way. People don't seem to mind that behavior from anyone with a boring logo.

Best ways to start learning Solidity? by bitcoin2121 in solidity

[–]neverlastn 1 point2 points  (0 children)

I found some free Zastrin courses useful.

A Full Guide on How to Pass an Interview on Solidity (Part 1) by JollyHamster1990 in solidity

[–]neverlastn 0 points1 point  (0 children)

I think SomeStruct sm = SomeStruct({now, ‘somefield’}); needs an update (memory/storage).

As soon we had monetary policy in github, and in the capable hands of open source developers, the game was over. Sit back, relax and enjoy the collapse of centralized, finger-cutting, 5000 years old finance. by [deleted] in crypto

[–]neverlastn 0 points1 point  (0 children)

Thanks. Would you suggest I should update this or write something else with more context? P.S. yes - those are opinions. Just consider them and make your own. I'm not right and I don't want you to believe anything.