|
Thanks for your help. Apparently it was VC++'s retarded defaults for empty projects that got me again. I went through and made sure everything was the same as another project (it wasn't). It works now but I'm not even sure which option was the culprit. I guess I could pull the old one out of SVN if I really want to find out, but I'd rather forget about it.
|
# ? Mar 19, 2008 01:23 |
|
|
# ? Apr 23, 2024 17:57 |
|
I am using VC++ 2005 express. I have sections of code that are #if'ed out sometimes. When editing this code, VC++ decides to gray it out and disable "go to definition" and friends in the context menu. This makes it more difficult to edit this code, which does actually get compiled sometimes. I would like it to treat all code as live code regardless of whether it looks like it will be compiled. I can't find anything relevant in any of the config screens. How do I do this? e: I can make the code not be grayed out from tools>options>text editor>c/c++>formatting, but that doesn't enable "go to definition" Hyphen-ated fucked around with this message at 03:20 on Mar 19, 2008 |
# ? Mar 19, 2008 02:49 |
|
Hyphen-ated posted:I am using VC++ 2005 express. I have sections of code that are #if'ed out sometimes. When editing this code, VC++ decides to gray it out and disable "go to definition" and friends in the context menu. This makes it more difficult to edit this code, which does actually get compiled sometimes. I would like it to treat all code as live code regardless of whether it looks like it will be compiled. Visual Assist can handle this, and it's Go To Definition isn't retarded like VS's is. Of course it's also money.
|
# ? Mar 19, 2008 04:47 |
|
Is it legal to reinterpret_cast a char * to signed char * or unsigned char *? Some sources online indicate 'yes', but I can't find anything in the standard to back me up.
|
# ? Mar 19, 2008 07:28 |
|
Yes.
|
# ? Mar 19, 2008 07:31 |
|
That Turkey Story posted:Yes. I mean 'legal' as in it is guaranteed to do what you expect when you read from or write to the pointer. Can you give me where in the standard implies that? 5.2.10.7 seems to indicate otherwise: 5.2.10.7 posted:A pointer to an object can be explicitly converted to a pointer to an object of different type.65) Except that converting an rvalue of type “pointer to T1” to the type “pointer to T2” (where T1 and T2 are object types
|
# ? Mar 19, 2008 07:50 |
|
A char is not an object.
|
# ? Mar 19, 2008 15:06 |
|
Has anyone been able to get Purify 7.0 properly working with Visual C++ in Visual Studio 2008, if so, what did you have to do to get both pieces of software working correctly? I'm having a hell of a time getting purify to show me the exact line numbers where errors are occuring. Right now, I get something like: Error at Class.obj:123 instead of Error at Class.cc:123. For some reason purify isn't finding my source code, despite the fact that I specified the exact directory in the source look up.
|
# ? Mar 19, 2008 17:06 |
|
JoeNotCharles posted:A char is not an object. Yes, it is.
|
# ? Mar 19, 2008 20:52 |
|
§3.9.1 #1 posted:Objects declared as characters (char) shall be large enough to store any member of the implementation’s basic character set.
|
# ? Mar 19, 2008 21:29 |
|
WalletBeef posted:Has anyone been able to get Purify 7.0 properly working with Visual C++ in Visual Studio 2008, if so, what did you have to do to get both pieces of software working correctly? It apparently doesn't work with VS 2008 PDB files. That' my guess, anyway. I was upgraded from 2005 to 2008 and started seeing exactly the problem that you describe. The good news is that the line numbers are accurate (though sometimes it will strangely specify the wrong object file). You just have to open them up outside of Purify.
|
# ? Mar 19, 2008 22:28 |
|
Plastic Jesus posted:It apparently doesn't work with VS 2008 PDB files. That' my guess, anyway. I was upgraded from 2005 to 2008 and started seeing exactly the problem that you describe. The good news is that the line numbers are accurate (though sometimes it will strangely specify the wrong object file). You just have to open them up outside of Purify. Well, I was afraid of that. The next logical step I was going to take was to uninstall 2008 and go with 2005. Thanks
|
# ? Mar 20, 2008 03:40 |
|
Horrible newbie question: In this code: code:
code:
VV That's the ticket. I bumped ProdChar's size up by one and it fixed it. Thanks! Erwin fucked around with this message at 13:16 on Mar 20, 2008 |
# ? Mar 20, 2008 12:53 |
|
Erwin posted:Horrible newbie question: How do I know? 9009 = 0x2331 8960 = 0x2300 So the least significant byte of Greatest has been stomped on. Which then tells me you're running on a little endian machine, and that ProdChar and Greatest have been declared right next to each other.
|
# ? Mar 20, 2008 13:12 |
|
Plastic Jesus posted:It apparently doesn't work with VS 2008 PDB files. That' my guess, anyway. I was upgraded from 2005 to 2008 and started seeing exactly the problem that you describe. The good news is that the line numbers are accurate (though sometimes it will strangely specify the wrong object file). You just have to open them up outside of Purify. Well, I installed VS 2005 and Purify is happy. It's showing line numbers, source code and all. Thanks a loving ton.
|
# ? Mar 20, 2008 17:47 |
|
Is there a way to test if an Object element variable is an integer, string, or char string?
|
# ? Mar 20, 2008 19:36 |
|
graffin posted:Is there a way to test if an Object element variable is an integer, string, or char string? Are you talking about C# or something? C++ is too strongly typed to cleanly support a standard Object type, but Java and C# do.
|
# ? Mar 20, 2008 19:53 |
|
Drx Capio posted:Are you talking about C# or something? C++ is too strongly typed to cleanly support a standard Object type, but Java and C# do. I'm using it in C++, in the context of a template for a binary tree based dictionary. The object is an element in a node. In the dictionary, I'm trying to test the element to determine if it is an int or string.
|
# ? Mar 20, 2008 20:00 |
|
graffin posted:I'm using it in C++, in the context of a template for a binary tree based dictionary. The object is an element in a node. In the dictionary, I'm trying to test the element to determine if it is an int or string. C++ doesn't have any facility for determining what basic type a symbol is, RTTI only works on classes. Also, if your template class has to implement different functionality based on the type of the varying element, you may want to revisit its design.
|
# ? Mar 20, 2008 20:05 |
|
graffin posted:I'm using it in C++, in the context of a template for a binary tree based dictionary. The object is an element in a node. In the dictionary, I'm trying to test the element to determine if it is an int or string. Standish fucked around with this message at 20:19 on Mar 20, 2008 |
# ? Mar 20, 2008 20:16 |
|
Standish posted:http://codepad.org/cTLm8Woy Cool. Thanks.
|
# ? Mar 20, 2008 20:26 |
|
graffin posted:I'm using it in C++, in the context of a template for a binary tree based dictionary. The object is an element in a node. In the dictionary, I'm trying to test the element to determine if it is an int or string.
|
# ? Mar 20, 2008 20:27 |
|
Teach me about 64-bit integers in C. In Java, int is four bytes and long is eight bytes. That's not the case in C, where, if I understand correctly, sizeof(long) only has to be at least equal to sizeof(int). So what should I do when I need a 64-bit integer?
|
# ? Mar 20, 2008 22:02 |
|
elevatordeadline posted:Teach me about 64-bit integers in C. #include <stdint.h> This gives typedefs that include number of bits, like uint8_t for unsigned 8-bit integers, and int32_t for signed 32-bit integers. Only up to 32 bits are required, but your implementation might have int64_t and uint64_t.
|
# ? Mar 20, 2008 22:08 |
|
elevatordeadline posted:Teach me about 64-bit integers in C. I'm not 100% about the standardization of these, but I'm pretty sure 'long long' and 'int64_t' are 64-bit.
|
# ? Mar 20, 2008 22:08 |
|
uint64_t and unsigned long long both work as long as I'm using gcc -std=c99. Hooray. Evidently, though, I don't understand what to do next. For example, code:
code:
|
# ? Mar 20, 2008 22:40 |
|
WalletBeef posted:Well, I installed VS 2005 and Purify is happy. It's showing line numbers, source code and all. Thanks a loving ton. np. I've tried various cl.exe and link.exe switches and I can't get VS2008 to generate the old-style PDB files. I'm a deeply lazy man, though, and don't feel like going back to 2005. I also have a weirdish development environment (I mount my windows drive from my mac and edit everything in vim), so I'm used to just opening the source files and finding the offending lines. Hopefully, though, IBM will release a fix soon enough. I don't know if you've tried dealing with IBM support yet but DO NOT attempt to submit this as a bug. You'll end up with a self-inflicted bullet wound.
|
# ? Mar 20, 2008 22:55 |
|
elevatordeadline posted:uint64_t and unsigned long long both work as long as I'm using gcc -std=c99. Hooray. Evidently, though, I don't understand what to do next. I don't recognize those format characters, so I'm assuming you have some extension of printf that does. Are you sure it's reading/writing 8 bytes?
|
# ? Mar 20, 2008 23:00 |
|
elevatordeadline posted:Those numbers are not the same numbers at all. Works for me on x86_64 ( native 64-bit integers), gcc version 4.2.3 code:
|
# ? Mar 20, 2008 23:12 |
|
elevatordeadline, you're code works fine on my 64bit MacBook Pro running OS X 10.5 with gcc version 4.0.1 and also on a 32bit RHEL4AS machine with gcc version 3.4.6. You might open up your inttypes.h file and see what's in there. You may not find a perfectly portable solution, unfortunately.
|
# ? Mar 20, 2008 23:24 |
|
Lexical Unit posted:You might open up your inttypes.h file and see what's in there. You may not find a perfectly portable solution, unfortunately. code:
|
# ? Mar 21, 2008 00:53 |
|
I'm working on a blackjack program for my c++ class, but I'm having trouble working with all the separate files. When I compile the driver program, I get:code:
|
# ? Mar 22, 2008 02:58 |
|
chris_bacon posted:I'm working on a blackjack program for my c++ class, but I'm having trouble working with all the separate files. When I compile the driver program, I get: Never include .cpp files. The header files (.h) contain information about the class that other files need to know -- basically, what functions/members are a part of the class. The source files (.cpp) contain definitions for the functions. A simple example: Player.h (lay out the interface) code:
code:
code:
Once you start dealing with inlines and templated code, things will be a little more complicated. But at your level, the above holds true. ColdPie fucked around with this message at 04:18 on Mar 22, 2008 |
# ? Mar 22, 2008 04:16 |
|
Alright, one more related question. Whenever I try to compile deck.cpp, I get this error:code:
|
# ? Mar 23, 2008 02:25 |
|
That error means that there is no main function anywhere that gcc can find. It's trying to produce an executable and can't figure out where your code takes over once the process is created. Where is main? Is there a path of includes leading to it from deck.cpp? If you want to produce an object file for linking later you have to use a different invocation of gcc.
|
# ? Mar 23, 2008 02:42 |
|
HB posted:That error means that there is no main function anywhere that gcc can find. It's trying to produce an executable and can't figure out where your code takes over once the process is created. ah, I forgot to add -c when compiling. thanks for the help.
|
# ? Mar 23, 2008 02:44 |
|
I'm having some trouble getting standard iterators to work, and google isn't giving me much help. Currently I have something like this: code:
When I compile (using VS2008) I get an error saying: code:
Is there another class I should be deriving from or different template arguments I should be providing to std::iterator? The only requirements I have for the iterator are that it can advance forward and check for equality with other iterators (as well as access whatever it points to, obviously). I've noticed that the functions in the <algorithms> header just use templates that take any old class as an iterator, leaving it up to the user to make sure it supplies the proper operations. I would assume that is because they need to support pointers as well as actual iterator classes. Even though I don't need the support for pointers, would this be a better approach for my problem? I've been avoiding it so far because I want to make this as standardized as possible, plus I don't know the syntax for a member function with additional template parameters from its class. Can I just use nested templates?
|
# ? Mar 23, 2008 20:54 |
|
Dransparency posted:Even though I don't need the support for pointers, would this be a better approach for my problem? Yes. quote:I've been avoiding it so far because I want to make this as standardized as possible, plus I don't know the syntax for a member function with additional template parameters from its class. Can I just use nested templates? Yes. Depending on what exactly class Foo is supposed to do, there might not even be a need for it.
|
# ? Mar 23, 2008 23:00 |
|
Internet research reveals that std::iterator is not supposed to be used as a base class for iterators. The entire point of the whole generic programming thing is that you do not need to derive from stupid classes just to make functions work on your types. std::iterators provide some typedefs to help meeting the iterator requirements I guess. The definition given in the standard is code:
|
# ? Mar 24, 2008 00:10 |
|
|
# ? Apr 23, 2024 17:57 |
|
Hopefully, in C++0x, there will just be an "iterator" concept. The more I think about concepts, the more I like them.
|
# ? Mar 24, 2008 00:54 |