25 karma · joined Oct 12, 2019 (7y ago) · 24 submissions
comment 6y ago · link · parent
comment 6y ago · link · parent
Moc just adds some more generated code next to you valid C++ code, generally in a new translation unit. That generated code is just boiler plate which you could write by hand if you wanted. In a sense this is what verdigris does: it provides macros that makes makes it easier to "write it by hand" (the W_OBJECT_IMPL macro somehow expends to the code generated by moc)
comment 7y ago · link · parent
comment 7y ago · link · parent
For example, no need to understand the magic behind the 'quote!' or the #[async_trait] macros to use them.
comment 7y ago · link · parent
Although in this case, I guess this is probably fine since the non-atomic read can't race with a write.
comment 7y ago · link · parent
Can't you get some values "out of thin air" (partial updates of some bits.) Or some intermediate values?
(For example, can the compiler decide to use this memory location to store some unrelated temporary result, as it knows it will erase it soon with a final value and that no other threads is supposed to access this)
comment 7y ago · link · parent
https://code.woboq.org/qt5/qtbase/src/corelib/global/qglobal...
comment 7y ago · link · parent
About the copy/paste of protobuf files, it works but makes it more difficult to keep them in sync.
And I did not say you need a single repo. I'm saying the stated disadvantages of multi repo are real.
comment 7y ago · link · parent
See "less is exponentially more".
The same way some electric bikes are restricted to a given speed to keep their user safe. Some people call it "crippled", while some other call it "simple and safe to use".
comment 7y ago · link · parent
It is a compiler error to use the value after it was moved. And the compiler error is quite explicit about how to solve it
For example you can explicitly clone
let y = add(x.clone());
let z = add(x);