|
roomforthetuna posted:But it's pretty contrived and unnecessary, since you could get that behavior by just having a non-virtual TreeNode::BeginClimb() function or something in addition to the pure virtual one.
|
# ? Aug 11, 2011 20:01 |
|
|
# ? Jun 10, 2024 12:33 |
|
roomforthetuna posted:Someone asked earlier but not very clearly, are you in the right configuration? It's possible that the preprocessor definitions that you see in the file are for debug or release build only, and you're looking at the other one. Yep, everything looks right, and the Preprocessor defines that are listed in the dialog do not show up in the vcproj under the <tool VCCCompilerTool or whatever I posted originally section. Everything works, I'm just not clear on how it got to this state in the first place. I checked the history of the vcproj and it got added back when the vcproj was for either 2005 or even 2003, maybe it's just something with the conversion didn't bring it along. Or maybe the dialog is stripping it out since it's using the $() environmental variable bullshit.
|
# ? Aug 11, 2011 20:39 |
|
You checked the history in version control? Could it have been caused by a merge error, maybe? I've had weird things happen with XML files being merged with SVN before... Are there maybe two tool="VCCCompilerTool" nodes and it's ignoring the second one?
|
# ? Aug 11, 2011 22:02 |
|
That Turkey Story posted:All compliant compilers do. You can always define the body of a pure virtual function. The Microsoft extension he was talking about was that you can define them inside the class definition -- normally you have to define them outside of the definition. Yes. Although it's really dumb that you can do this at all.
|
# ? Aug 11, 2011 23:11 |
|
If you build boost on a 64-bit machine, using MSVC 9.0 (which is Visual C++ 2008), and you don't specify anything about address-model, will it default to building a 64-bit version or 32-bit? Asking because I recently changed my compilation machine to a new one, Windows 7 64-bit, and now my project using libtorrent-rasterbar, which uses boost, is behaving erratically. I haven't changed any settings or any code that should be libtorrent-related, and all the libraries are the same version as I was using before, so I'm grasping at straws for what might now be going wrong. The only thing I've changed other than the dev environment is the torrent file, but the new one works fine with uTorrent, and is generated by libtorrent-rasterbar, so I can't see how that would be causing a problem. (And stepping through libtorrent code in debug mode it appears to be handling the file just fine, I just lose track of it where it calls into boost::bind asynchronously - at that point it should be connecting to my webserver and doesn't seem to be doing so.) roomforthetuna fucked around with this message at 00:11 on Aug 14, 2011 |
# ? Aug 14, 2011 00:09 |
|
You can't mix 32-bit and 64-bit code on AMD64, so it flat out wouldn't link if boost spontaneously started being built 64-bit.
|
# ? Aug 14, 2011 00:16 |
|
Thanks - turned out the problem was it wasn't the same version of libtorrent after all, and the new version was broken in its dealing with URL seeds (as well as having some crash bugs with logging enabled when compiled with MSVC). So I emailed the guy fixes for the problems I found, and reverted to using the older version for myself. What a frustrating waste of a day. To contribute something that might be interesting to others, the "offsetof" macro, even the adjusted for C++ one Microsoft uses, causes a crashing exception in the event of something like: code:
|
# ? Aug 14, 2011 01:37 |
|
That generates a warning but works correctly in both clang and gcc. edit: And it doesn't have anything to do with a being a reference, the problem is that the C++ standard says that offsetof() on a non-POD type isn't allowed. OTOH, offsetof() will work correctly on a great many flavors of non-POD types, so people still use it. Apparently MSVC will poo poo itself, though. pseudorandom name fucked around with this message at 02:05 on Aug 14, 2011 |
# ? Aug 14, 2011 01:59 |
|
It compiles without a warning in MSVC, and then crashes on execution (which is actually what I'd expect, since using the address operator on a reference value gives the address of what is referenced, not the address of the reference value). Just had a look on a gcc system and it looks like it's not a preprocessor definition at all there, but a true operator like sizeof (at least, I can't find it being #defined anywhere in the include dir)
|
# ? Aug 14, 2011 02:09 |
|
stddef.h is special, and you'll find it somewhere similar to /usr/lib/clang/2.8/include/stddef.h or /usr/lib/gcc/x86_64-redhat-linux/4.6.0/include/stddef.h. And they both #define offsetof(a, b) __builtin_offsetof(a, b)
|
# ? Aug 14, 2011 02:12 |
|
So back to the question I was asking, is there any way syntactically (short of a compiler builtin that figures it out for you) to get the offset to a reference value in a class? (Assuming you don't know what else is in there so you can't fudge it as something relative to another value.) I'm guessing no because if there was something it'd be in Microsoft's stddef, but maybe there is something that just wouldn't also work on non-references? This is not something I'm trying to do, so no need to answer with ARGH DON'T DO IT, I'm just curious whether it can be done, because of that library trying to do it.
|
# ? Aug 14, 2011 02:22 |
|
Not portably, no. The standard makes no promises about the storage of references.
|
# ? Aug 14, 2011 02:31 |
|
roomforthetuna posted:If you build boost on a 64-bit machine, using MSVC 9.0 (which is Visual C++ 2008), and you don't specify anything about address-model, will it default to building a 64-bit version or 32-bit? Always 32-bit, as 64-bit is Professional+ versions only.
|
# ? Aug 14, 2011 03:05 |
|
MrMoo posted:Always 32-bit, as 64-bit is Professional+ versions only. If you install the (free) Windows SDK you can target 64-bit platforms using the express editions of Visual C++.
|
# ? Aug 14, 2011 07:27 |
|
I'm back with more circular dependencies/forward references/compiler just being nasty about my stuff. At this point I have a lot of source files referring to each other. What has ended up hurting me has been trying to break up particular classes into separate files. So I have stuff like: 1. class A in one file refers to class B in another file, and vice versa. 2. Add in class C with similar back-and-forth references classes A and B. 3. Add in some other classes that use classes A and B in different capacities. At this point I'm dealing with the preprocessor not finding #include paths that are quite clearly there, at least at the location of the file in question. I have to assume these are getting dragged into a source at another path, and subsequently screwing up the compiler. Overall, I am wondering what I can do to mitigate this mess. The breakup of the files makes sense from a design and programming standpoint, but I have to figure out how to make the compiler happy. The best I can come up to at this point is to put all the stuff in a big orgy into one common header that enforces at least some kind of order, and just let anything that needs to take advantage of the interplay of objects to include that file in particular. I just ask about that now because it'll take a lot of refactoring around and I'm not entirely sure I won't get out of the woods with it either.
|
# ? Aug 14, 2011 14:15 |
|
There are some basic rules to getting that kind of thing working. When two or more classes must refer to each other, don't #include the other class's file into the header. Use forward declarations instead. You can #include whatever you need into the actual source files. Of course, forward declaration means that your class declaration can only refer to the forward declared class by address. If I'm telling you what you already know, then you've ballsed up somewhere. Maybe you need to think about restructuring the whole thing. Don't fall into making an uber-header just to get things working.
|
# ? Aug 14, 2011 15:41 |
|
Edit: I am a moron who cannot point his slashes the right way. That was all there was too it. To be fair, I had thought I tried that first thing.baby puzzle posted:If I'm telling you what you already know, then you've ballsed up somewhere. Maybe you need to think about restructuring the whole thing. I'm using relative paths for the source tree, so the #include is like "..\..\stuff.hpp" and I haven't figured out through exhaustion what might alternately make it happy. Maybe I'll try absolute path for giggles. Sorry for all this ramblings but I'm kind of thinking out loud in the thread. Rocko Bonaparte fucked around with this message at 17:15 on Aug 14, 2011 |
# ? Aug 14, 2011 16:39 |
|
I have a stream of input messages, each of which triggers a handful of sequential operations. It's easy enough to do procedurally, but because some of the operations block on IO, I'm hitting a performance wall which is killing my throughput. So I want to pipeline the work, and my first thought is to break it into distinct tasks for each shared resource, and call them asynchronously. Is boost async the best bet here? Should I be trying a completely different approach?
|
# ? Aug 14, 2011 17:12 |
|
Rocko Bonaparte posted:I'm using relative paths for the source tree, so the #include is like "..\..\stuff.hpp" and I haven't figured out through exhaustion what might alternately make it happy. Maybe I'll try absolute path for giggles. code:
#include "../file2.h" #include "../../file1.h" Or file3.cpp does #include "../file2.h" and file2.h does #include "../file1.h" To simplify this sort of thing, another option is to add each of the paths to your preprocessor include paths, and use angle-bracket includes #include <file2.h> or (to avoid using complete paths) add just the "project" directory to your include paths, and #include <subdir/file2.h>
|
# ? Aug 14, 2011 17:18 |
|
Also, MSVC is (thankfully) quite happy with parsing paths with forwardslashes instead of backslashes. So #include "../../blah.h" will work even when building on Windows.
|
# ? Aug 14, 2011 18:49 |
|
I'm actually not aware of anything in windows that DOES care about forward slashes vs. back slashes
|
# ? Aug 14, 2011 18:52 |
|
So I'm learning about overloading operators and my professor posted this code sample:code:
|
# ? Aug 14, 2011 20:39 |
|
obj is assigned to a new instance of type MyString. MyString(tmp) constructs a temporary object. obj is immediately assigned to this temporary object. Most likely a copy operation occurs, so now the two objects are equivalent (but not the same object). The temporary object on the right hand side of the expression then disappears from existence after the assignment.
|
# ? Aug 14, 2011 21:16 |
|
that also won't compile because obj is const.
|
# ? Aug 14, 2011 21:28 |
TasteMyHouse posted:I'm actually not aware of anything in windows that DOES care about forward slashes vs. back slashes I believe some of the lower levels in the kernel does, but if that applied to you you'd probably already know
|
|
# ? Aug 14, 2011 21:48 |
|
TasteMyHouse posted:that also won't compile because obj is const. Maybe it has a const assignment operator
|
# ? Aug 14, 2011 21:54 |
|
That Turkey Story posted:Maybe it has a const assignment operator
|
# ? Aug 14, 2011 22:14 |
|
nielsm posted:I believe some of the lower levels in the kernel does, but if that applied to you you'd probably already know Also the command shell does - just try running debug/something.exe.
|
# ? Aug 15, 2011 01:42 |
|
Thanks for the help! I have two more questions! (and probably a lot over the next two weeks as I have a final coming up for this class, which is going to kick my rear end). 1.) code:
2.) code:
Jesus Christ, typing this out and thinking about this class makes me feel so loving stupid. I've never struggled with a class like this. I seem to understand it when I read through everything but when I go back I am absolutely lost. It's the worst information overload I've ever experienced. Good Will Punting fucked around with this message at 02:32 on Aug 15, 2011 |
# ? Aug 15, 2011 02:22 |
|
1.) The default NameRecord constructor will be called "numRecs" times on line 2, once for each object in the array. The default constructor is a constructor with no parameters. If such a constructor isn't defined then it will be automatically generated by the compiler. 2.) Depends how operator > is implemented for the type of first and last.
|
# ? Aug 15, 2011 02:41 |
|
Well both of those make sense and I now have a much better idea of what's going on. Thanks a lot for the speedy reply! I'd like to think brainfarts like this happen when you're first learning and spend 6 hours just reading about new concepts staring at code.
|
# ? Aug 15, 2011 02:50 |
|
Jabor posted:Also the command shell does - just try running debug/something.exe. Haha Windows owns:
|
# ? Aug 15, 2011 15:16 |
|
TasteMyHouse posted:Haha Windows owns:
|
# ? Aug 15, 2011 16:48 |
|
Ran into a bug in VS2010. The following crashes the compiler when compiled in Release mode. It does compile fine without the static modifier. Found this somewhat interesting.code:
|
# ? Aug 16, 2011 10:03 |
|
rikshot posted:Ran into a bug in VS2010. The following crashes the compiler when compiled in Release mode. I went to file a bug for this today but I couldn't reproduce it. Do you have SP1 installed? Do you have any non-default configuration settings in your Release configuration? Do you get any information beyond "it crashes" from the compiler?
|
# ? Aug 17, 2011 05:28 |
|
brosmike posted:I went to file a bug for this today but I couldn't reproduce it. Do you have SP1 installed? Do you have any non-default configuration settings in your Release configuration? Do you get any information beyond "it crashes" from the compiler? code:
I have SP1 and all the latest updates etc. People seem to get this error with some other C++11 features as well. Can't wait to switch to LLVM & Clang.
|
# ? Aug 17, 2011 20:59 |
|
Is there a native way to add two entire arrays (same size) to each other instead of having to loop through the array's size and add each variable one at a time? I'm looking for an easier way to do this: code:
elite_garbage_man fucked around with this message at 02:39 on Aug 19, 2011 |
# ? Aug 19, 2011 02:33 |
|
elite_garbage_man posted:I know the sum/display would need to be added to a new array instead of x or y. I'm just showing you guys what I'm using now. How about you show what you actually want to do instead of something that is not that? Edit: Also, no there's no native way. Unless the arrays are declared with a fixed size.
|
# ? Aug 19, 2011 02:36 |
|
code:
|
# ? Aug 19, 2011 02:57 |
|
|
# ? Jun 10, 2024 12:33 |
|
Thank you.
|
# ? Aug 19, 2011 03:04 |