Should I revert “real” references?

I can’t see any point when you can use pointers. Is there any use case for them? In case you aren’t aware, the last change I made to BooBoo had references that you could take the address of and get the address of the variable passed as a reference… C++ doesn’t have these kind of references and there is a significant overhead when doing it. So I want to remove them unless there is a reason I don’t think of. Anyone?

Comments

One response to “Should I revert “real” references?”

  1. admin Avatar
    admin

    To help you decide, the overhead is every instance where a reference variable is used in a function, the whole function’s parsed state is traversed to find them then they are switched to refer directly to the original variable. This happens every function call for every reference. The old behaviour I’d restore, just swaps the references’ last value into the original variables after the function call returns…

    I mean, if you don’t want to use pointers, then the behaviour doesn’t change anyway, because it only affects using the reference as a pointer (taking the address of it…) Instead taking the address of a reference will be considered something that leads to undefined behaviour (you’ll be taking the address of a local and if you use it out of scope it could crash or just give wrong results.)

Leave a Reply

Your email address will not be published. Required fields are marked *