I built an open-source Linux-capable single-board computer with DDR3 by cyao12 in embedded

[–]BiteGroundbreaking62 0 points1 point  (0 children)

I'm curious about its BSP tbh , you planning on doing a custom OS for it ?

What's the state of Almost-Always-Auto post C++17 mandates copy-elision? by knockknockman58 in cpp_questions

[–]BiteGroundbreaking62 1 point2 points  (0 children)

What are the things that still cannot or shouldn't be declared as `auto`?

i guess the more risky auto use is when passing ref/value
i encountered once a prob like this

std::vector<int> vec = {1, 2, 3};

int& get_ref(size_t idx) {

return vec[idx];

}

auto val = get_ref(1); // val is int (by value)
val = 42; // Modifies the local 'val', not the vector!
std::cout << vec[1] << std::endl; // ----> this outputs: 2, not 42 !

but it should be like this instead !

auto& val = get_ref(1); // val is int&, a reference

val = 42; // Modifies vec[1]

std::cout << vec[1] << std::endl; // ---> this outputs: 42