• Advertisement

tanzanite7

Member
  • Content count

    264
  • Joined

  • Last visited

Community Reputation

1409 Excellent

About tanzanite7

  • Rank
    Member

Personal Information

  • Interests
    Programming
  1. Given: template<typename T> struct Thing { Thing(std::initializer_list<T> arr) {...} }; template<typename T> struct Arbiter { template<typename ...Args> Arbiter(type stuff, Args ...args) : subject(args...) {...} T subject; }; typedef Arbiter<Thing<int32u>> Arbiter32u; Arbiter32u test1(stuff, {1U,2U,3U}); // error C2661 : no overloaded function takes 2 arguments auto wtf = {1U,2U,3U}; Arbiter32u test2(stuff, wtf); // this is fine Why does 'test1' fail where 'test2' is fine? Presumably the constructor used is removed by SFINAE - but why? SFINAE unfortunately masks out whatever goes wrong leaving me just puzzled :/. edit: Found something relevant to the 'auto' special rule: https://stackoverflow.com/questions/26330499/why-is-there-a-special-type-deduction-rule-for-auto-and-braced-initializers-in-c?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa ... still not sure i get it.
  2. C++ workaround for invalid C2247 error

    Yes, i have considered that. Unfortunately, the code referencing snafu logically may not ask explicitly for global scope - it must use current scope. That said, i am considering forbidding use of global logger without explicitly asking for it - which would work around the actual problem without so much smell. But that has to wait atm.
  3. C++ workaround for invalid C2247 error

    No. It (Bar) should not try to access a member it should not even know exists (in Foo) and use the variable in global scope it does see and as far as implementer of Bar is concerned - is the only one the implementer can be reasonably expected to know about. One could make a reasonable argument of precedence that the compiler should issue a warning about Foo hiding global snafu, but not generate any errors (ie. like VC warning about member function parameter name hiding class members) - implementer of Bar does not know an unrelated variable with that name exists inaccessibly in Foo and the compiler should use the global snafu. Anyway, this all is pretty much moot as i am fairly sure it works as specified - so, while idiotic, it is the correct way and that is what matters.
  4. C++ workaround for invalid C2247 error

    Neither would i - that was not the problem. Seems none of you understood it. However, it served me to become suspicious ... I suspect it is an error in the language standard itself. Given the horrendous nature of C/C++ - would not surprise me in the slightest. Common sense tells that inaccessible private members should be invisible - as doing otherwise would require that implementer of derived class must know and account for all private internal details of the whole parent class chain to avoid accidental private identifier name collisions. This is beyond ridiculous to put it very mildly - yet, i suspect now, that seems how it is supposed to "work" for some reason i cannot fathom. Is anyone familiar enough with the standard to be able to find where it is specified? Would like to amend my bug report if i can find a tangible reason to do so. Would be my first invalid VS bugreport ever in a long line of confimed/fixed reports - bound to happen one day. edit: Checked with godbolt - same result all around. This very strongly hints that it is indeed a language problem. For crying out loud.
  5. Ran into bizarre vc++ error, minimal example code: int snafu; struct Foo { static int snafu; }; int Foo::snafu; struct Mid : private Foo {}; struct Bar : Mid { void really() { snafu = 7; } // error C2247: 'Foo::snafu' not accessible because 'Mid' uses 'private' to inherit from 'Foo' }; The error is nonsense - implementer of Bar should not know/care about private internals of Mid. Reported the problem - but obviously cannot wait for a fix. Any idea how to work around this problem? Background: * 'snafu' is actually a context specific logger instance - the global instance is ... well ... for generic fallback context when there is no need for having a context specific one. * Mid is not a Foo, Mid has/shares a Foo implementation. Similar to composition. * Composition is not an usable alternative as it would need friending a lot of classes dealing with Foo part of Mid who currently do not even know/care about there being a Mid or whatever else. edit: Oh, ffs. I guess having to describe the problem to others helps. Workaround: add a static reference in Bar to global snafu. Ie: int &Bar::snafu = snafu. Have not yet tested it, but pretty sure it will work. edit: Yes, it does work. Annoying that i have to do it, but oh well.
  6. vkQueuePresentKHR is busy waiting - ie. wasting all the CPU cycles while waiting for vsync. Expected, sane, behavior would of course be akin to Sleep(0) till it can finish. Windows 7, GeForce GTX 660. Is this a common problem? Is there anything i can do to make it behave properly?
  7. Followup:   Tried the old code with U3 - same behavior. Which at this point i am confident enough to call a bug (*) - no compiler should fail at this kind of basics. I have compared both compilations and they are nearly identical (even ends up using the exact same registers with same instructions throughout) - with the sole exception of minor difference at the function call site and the unnecessary spill (non-spilling code just uses R8 [free to trash] instead of RBX [requires spill]) and frame code.   Platform Toolset: Visual Studio 2015 (v140). Is this correct? How can i confirm the new compiler is in use (edit: i did notice that the compiler specifically told it had to recompile all functions instead of doing the usual incremental rebuild)?   Did i miss something?   *) Which it obviously technically is not - since the functional end result is exactly what it should be.
  8.   Still on Update1. New optimizer? Did not know that, thanks. Well, then i need to update - will do that.   However, before i revisited the forums today i noticed (since all that code was on slow path i did not care much what happened on that path before) that i can easily convince the compiler to tail-call optimize out the, somehow offending, function call:   ----------------- before:         auto res = man.get(at);         man.lock.put();         return res; ----------------- after:         return man.getAndUnlock(at);   ... and the compiler happily obliged - all of the spill nonsense is gone (ebx gone and all the frame junk also gone [since all the function calls got tail-call optimized causing the caller to be essentially leaf function enabling all relevant optimizations]).   So, unfortunately can not tell whether U3 would have made a difference (would be interesting to know, so might un-fix when i update).
  9. I am experiencing a perplexing registry spill in a function that uses ONLY (spill inclusive) the following registers: rax, rbx, rcx, rdx, rsp.   rsp: for spill (and one call - cannot remember whether it is required ... should be pointless in regards to unwind, dunno) rbx: for spill   Why would that happen? What could cause that? It does not even use all the volatile registers up ( https://msdn.microsoft.com/en-us/library/9z1stfyw.aspx ) - at least R8 and R9 are free (i think R10 and R11 are also with standard Win x64 ABI).   Excluding code for rbx spill itself, rbx ends up used exactly 4 times:   Twice on fast path: movzx       ebx,byte ptr [rcx+rax] lea         rdx,[rax+rbx*4]   Twice on slow path, which i do not really care about: lock cmpxchg dword ptr [rbx],ecx lock cmpxchg dword ptr [rbx],ecx   None of them look suspicious (pretty sure LEA can take whatever as its index register). It is hard to believe VS2015 fails that badly with the basics ... umm ... ???   I guess the function responsible for the call (also on the slow path) is the cause - if i comment it out then rsp and rbx will be unused. If i allow inlining the function then the fast path will be filled with spill code (quadrupled). The function, from callers perspective, is a simple one - equivalent to "static int foo(int)". The slow path ends with another function call, but it is tail-call optimized ("jmp". so, does not care about caller stack frame at all - irrelevant to the issue).   Fun times.
  10. Using SetConsoleCtrlHandler i set a handler that gets called when needed (CTRL_C_EVENT, CTRL_BREAK_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, CTRL_SHUTDOWN_EVENT) [either the RTL or the OS or whatever spawns a high priority worker thread to run it].   The handler signals the apps worker thread to to finish what it is doing and exit. Then it will wait till the main thread signals back that it is safe to exit the handler (which will terminate the process in case of CTRL_CLOSE_EVENT).   All of this works perfectly.   However, there is a long ignored slight problem in the main threads termination code (before signalling the CtrlHandler) which i opted to try to amend today ... and ran into problems.   VS2015 just does not let me debug any of it.   All i can see is the state at breakpoint (which is of limited use) - F11 etc will just instantly terminate the process (debug build of course). At breakpoint i can see that the CtrlHandler thread is waiting in my custom infinite spin-lock as it should ... so, who is killing my process? Can i stop it from doing that (it is not logoff/shutdown, so, what the hell)?   Currently trying to debug by just putting the breakpoint in different places and trying to guess by the visible state what is going on - needless to say, it would help immensely if i could just step through that code.   Any ideas?
  11. VS2015 without internet explorer

    I have no need nor intention to "bite the bullet" or whatever. The original problem has been solved as noted in previous post: http://www.gamedev.net/topic/675576-vs2015-without-internet-explorer/?view=findpost&p=5276280   However, an update to the question i raised that was not answered:   Reinstalling IE nuked some of the settings needed for Classic Explorer to work (allow third party extensions got unchecked) - so, i needed to get access to the so called "internet" options again. Previously the only way i knew to do that was though IE and had to temporarily install IE just for that. This time i had a bit more luck with searching (by the virtue of Classic Shell having a sensible help around that does not wander through unrelated programs like IE) ... so, ...   ... that darn thing is accessible through Settings -> Control Panel -> Internet Options. (yep, sue me, but i did not think of looking around in control panel)   That and the settings mentioned in the linked post are all that is needed to make VS happy. No need to have IE around.
  12. VS2015 without internet explorer

    Reporting back.   Installed IE11 and: * cookies must be allowed. * whitelisting (trusted sites) did not work (live.com, visualstudio.com, microsoft etc/etc) somewhy. Only thing i found was that at least VS2013 had a bug where the sign in process actually mistakenly checked javascript access against the "internet zone" even though all the sites were in "trusted sites" zone - maybe it has not been fixed with VS2015? * setting internet zone to high security (basically disabling everything) and specifically allowing javascript (active scripting) Uninstalled IE (+restart even though it did not ask for it, just to be sure) and its security settings remained intact.   Had no problems registering / signing in after that. Yay!     The frontend does very little (UI platform etc?) ... AFAIK, anything related to rendering an actual webpage is not considered to be part of it (the whole renderer is a separate embeddable component that is made basically inseparable from rest of the OS).   Comments from more knowledgeable dudes'n'dudettes welcome.
  13. VS2015 without internet explorer

      It does require an occasional re-checkin, so you might have issues.     :/ ... that would be a nuisance (especially if it really is as often as mentioned [1-2 months]). So, register-time temporary fix is a no-go ... whatever i do, it will have to always work.   IE has been gradually built into the OS with only the front end being made uninstallable (to get around the lawsuit while still maximizing interdependency). The constant crap avalanche IE presence caused via updates was why i got rid of it way beck when - now only the OS internal parts get updates.   Checked with Wireshark and the "sign in" makes some https traffic with distinctly MS related payloads/destinations to fly around - so, it seems to be able to use the built in part of IE just fine, but just lacks the rights to run Javascript as the message indicated.   I wonder if installing IE to add some whitelists and then immediately uninstalling IE will perma-fix the situation :/ Can i do that without installing IE? How?   Will try it out when i get the time and say how it goes.
  14. Is it possible to use Visual Studio 2015 without having internet explorer (OS: Win7)?   It seems that registering needs "sign in" and that i suspect demands internet explorer - which i do not have. I can not find anything useful about this issue due to sheer amount of false positives for any search term i can come up with.   Error message for license / 'sing in':     My web browser is Firefox and has no Javascript blocking. I suspect that the error message is just a blatant lie in the usage of the term "web browser" as VS is just hardcoded to use some IE component directly. Either way - i can not find anything about it. Are there any workarounds?   Suppose i get to register it somehow - will it keep working without internet explorer?
  15. No shit sherlock *massive-facepalm*. Why did you even write that? Was it not crystal clear that discussions (at least without a lot more details) in that direction is undesired waste of everyone's time?   As i wrote: "[b]ATTEMPT[/b] surviving broken code /.../ [b]something that is normally undesirable[/b]".   PS. Since you like to ASS-U-ME stuff about what is or is not sensible for me to do in my specific case: the code runs in kernel land and some in user land via callbacks - there is no way for the OS to survive or cleanup anything when the program is broken (the process cannot even be terminated because it is in essence part of the kernel at that point - so, you get kernel panic ... BSOD). However i can send a message and initiate a proper teardown and hope the corruption has not already wrecked the OS (the [b]chances[/b] happen to be actually pretty good that the OS will remain unharmed [ie. all internal structures in valid state]). An approach that is highly desirable, in my case, while in development phase.   So, no, you could not be more wrong. Don't assume you know the necessary context and details of what i am doing to ignore my PS'note in OP. It is exceedingly unhelpful.
  • Advertisement