mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
I ran into this while trying to get some printing going for places where we're creating thread local keys. Supposedly, just including `<iostream>` should statically initialize `std::cout/cerr`, but it gets really hard to reason about whether your statically initialized code is going to be initialized before or after that happens. I tried making sure that the TU for `fml/logging.cc` did that initialization statically, but that also failed in the verison of the test included here (it passed in some other iterations that modified run_all_unittests.cc). We _could_ make sure it happens each and every time we touch `std::cerr` but ... we could also just use `fprintf(stderr, ...)` and it works just fine. /cc @flar who ran into problems around this a little while back and was asking about it.