|
Avenging Dentist posted:Manually fix the IDs once, never worry about it again (for a while anyway)? If it's anything like resource IDs, it's sequential. For example: That solves it for the single developer case (provided we go through each of the project and normalize the resource IDs so that they are sequentially increasing from 1 with no gaps), but let's say we have the following scenario: 1) One developer sets the next resource ID to start at 40000 and checks the change into TFS. 2) The next morning, all developers get that update. 3) Five developers add one string to the same project's string table. Each of those strings has ID 40000. 4) Check-in time! The first developer checks in their change, then the second has to resolve a conflict. The new string is added to #2's table, he compiles again to make sure everything works because he is a good developer, and there is a conflicting ID. Repeat for #3, 4 and 5 This is why I'm thinking about solutions that fix the resource IDs at compile time...that way it really doesn't matter what IDs are used at design time. Resource lookup by integer is weak as hell, resource lookups by string fo' lyfe
|
# ? Jun 30, 2009 14:22 |
|
|
# ? May 23, 2024 01:27 |
|
csammis posted:That solves it for the single developer case (provided we go through each of the project and normalize the resource IDs so that they are sequentially increasing from 1 with no gaps), but let's say we have the following scenario: Ok so you have to resolve conflicts when merging, that's pretty much par for the course with development.
|
# ? Jun 30, 2009 18:17 |
|
Why can't each developer have his own starting ID?
|
# ? Jun 30, 2009 18:24 |
|
Sagacity posted:Why can't each developer have his own starting ID?
|
# ? Jun 30, 2009 18:28 |
|
TSDK posted:Close, but no cigar: per-person code rules are generally a bad idea. Each of the individual projects should have its own unique prefix for string IDs. I didn't explicitly say anything about per-project stuff since resource files are nothing but per project. String IDs don't exist in the VS resource thing-a-ma-bobber though.
|
# ? Jun 30, 2009 18:32 |
|
Avenging Dentist posted:Ok so you have to resolve conflicts when merging, that's pretty much par for the course with development. Conflict resolution is a fact of development life...that doesn't mean effort shouldn't be taken to reduce the incidence of conflicts. Avenging Dentist posted:String IDs don't exist in the VS resource thing-a-ma-bobber though. Not for C++ anyway. The C# resource editor exposes the string table using string IDs, though it may use integers under the hood.
|
# ? Jun 30, 2009 19:46 |
|
csammis posted:Conflict resolution is a fact of development life Sometimes conflicts escalate to physicality...
|
# ? Jun 30, 2009 20:12 |
|
Could you have developers create a GUID for each resource they add? The downsides of course are 1) if they're stored internally as integers it won't work very well, and 2) it's a bit of an overengineered (and cluttered) solution
|
# ? Jun 30, 2009 20:18 |
Is there any way to easily implement a simple job queue with callbacks using some combination of boost function libraries? It seems relatively simple to implement one with identical function signatures e.g.code:
|
|
# ? Jun 30, 2009 20:32 |
|
huge sesh posted:Is this possible with boost::bind? Yes.
|
# ? Jun 30, 2009 21:05 |
|
/\/\ Please elaborate, I could certainly stand to learn more about boost::bind. (Edit: Oh wait I get it, duh. Feel free to burn me with your explanation tho )huge sesh posted:
std::queue can't store boost::functions of different signatures because those are different types and std::queue holds just one type. But consider that boost::function allows arbitrary compatible function objects to be targets. How does this strike your fancy? code:
Edit: Or you could just use boost::bind, here's the above code re-worked: code:
Lexical Unit fucked around with this message at 21:37 on Jun 30, 2009 |
# ? Jun 30, 2009 21:05 |
Thanks, that nailed it.
|
|
# ? Jun 30, 2009 22:48 |
|
I recently got into C++, and I've been using the PDcurses library to make a small roguelike game. so far, I've been able to get the player to walk around, hit walls, and such. I'm trying to have more than 1 room in the window at once. I init two rooms from the room class, draw them, and etc. Unfortunately, the second room does not fill in with floor tiles. Here is the room class: code:
code:
|
# ? Jul 1, 2009 07:22 |
|
Rsugar posted:
Well one thing: breadth means exactly the same thing as width.
|
# ? Jul 1, 2009 07:32 |
|
Avenging Dentist posted:Well one thing: breadth means exactly the same thing as width. I know :I . I copied the drawing function from some random tutorial and then built on top of it. Breadth should be replaced with height, sorry. Edit: Fixed the problem. I forgot that when I was testing the first room for the first time, I didn't have the init function, and I was passing numbers to the Arows and Acols variables instead. I forgot to replace Arows and Acols with the init vars, and I did that and it worked. Though, now I have a different problem. The lower right corner of the second room does not get drawn... Foran fucked around with this message at 20:17 on Jul 1, 2009 |
# ? Jul 1, 2009 07:34 |
|
Don't do this. code:
code:
Zakalwe fucked around with this message at 02:48 on Jul 2, 2009 |
# ? Jul 2, 2009 01:45 |
|
So here's another one I probably won't get an answer on, but I'm out of ideas. I have a multi-threaded dll written in unmanaged c++ that displays a simple dialog box with an activex control. When it tries to create the control, I get an assertion failed error on line 410 in occmgr.cpp, here is part of the code:code:
Edit - looks like the dialog box works in another application, so it's an issue of it not finding the parent window for this one. That's what I thought the problem was until I researched it and there seemed to be several other causes. opie fucked around with this message at 21:21 on Jul 2, 2009 |
# ? Jul 2, 2009 16:57 |
|
I'm going to be starting a new project for which I have to use a library with C++ interfaces. It's targeted for Windows. Should I consider C++/CLI? I've read up some, but I don't know anything about it in practice. I've never done any .NET programming of any kind before, so this will be my first foray.
|
# ? Jul 2, 2009 20:38 |
|
GrumpyDoctor posted:I'm going to be starting a new project for which I have to use a library with C++ interfaces. It's targeted for Windows. Should I consider C++/CLI? I've read up some, but I don't know anything about it in practice. I've never done any .NET programming of any kind before, so this will be my first foray. In theory you can write .NET apps directly in C++/CLI but I wouldn't recommend that. I'd either write a thin C++/CLI wrapper around the C++ DLL using .NET or write the app in C++ without .NET.
|
# ? Jul 2, 2009 20:54 |
|
The last time I looked at C++/CLI it was kind of a clusterfuck. If you're set on using .NET for the rest of the application, using a proper .NET language like C# with P/Invoke is the way I would go.
|
# ? Jul 2, 2009 20:55 |
|
Thanks, those were exactly the kind of answers I was looking for. Guess I don't need to bother with it.
|
# ? Jul 2, 2009 21:32 |
|
Zakalwe posted:Don't do this. Actually, while I was working on the thing yesterday, I re-wrote the entire map generation function, so that it loads a hard-coded map. Next up is parsing config files so that I can load up monsters/items/etc. After that I'm going to work on a larger map than what I have now that takes up more than the entire screen, and then work on a way to scroll through it.
|
# ? Jul 2, 2009 21:50 |
|
Rsugar posted:
A while loop you say? I never would have guessed.
|
# ? Jul 4, 2009 00:59 |
|
Adhemar posted:A while loop you say? I never would have guessed. He forgot the "//end while" at the end though, makes it a bit confusing.
|
# ? Jul 4, 2009 01:03 |
|
Adhemar posted:A while loop you say? I never would have guessed. (I've seen this in code more times than I really should)
|
# ? Jul 4, 2009 04:04 |
|
Blame K&R.
|
# ? Jul 4, 2009 04:29 |
|
Adhemar posted:A while loop you say? I never would have guessed. What, you don't use pseudo-code and forget to erase it every so often?
|
# ? Jul 4, 2009 05:33 |
|
Rsugar posted:What, you don't use pseudo-code and forget to erase it every so often? code:
|
# ? Jul 4, 2009 08:24 |
|
Rsugar posted:What, you don't use pseudo-code and forget to erase it every so often? No, I write real code from the start.
|
# ? Jul 4, 2009 10:40 |
|
I write all my code like that ^^ starting with just the control structures, no details. Just to see what it ends up being. Like writing a song and deciding "verse, verse, chorus, verse, chorus, chorus"
|
# ? Jul 4, 2009 15:19 |
|
HauntedRobot posted:I write all my code like that ^^ starting with just the control structures, no details. Just to see what it ends up being. Like writing a song and deciding "verse, verse, chorus, verse, chorus, chorus" This is a whole new level of waterfall.
|
# ? Jul 4, 2009 16:14 |
|
Dijkstracula posted:I find "#define FOREVER while(1)" makes commenting the loop unnecessary! (Though their foreach is useful I'll admit)
|
# ? Jul 6, 2009 06:13 |
|
Since C++0x will (eventually) come with user-defined literals that allow you to convert a constexpr input string into a variadic template argument list, I figured I'd try to create something that lets you actually do something with it. So for the last few days I've been working on a highly experimental prototype of a Boost.Spirit2-inspired attribute-based, recursive descent parser.. with the parsing all being done at compile time! Example: code:
In this case, we have testparse::type -> mpl::vector<mpl::int_<32>, mpl::char_<'A'>, mpl::char_<'B'>, mpl::char_<'C'>> So far I haven't done any benchmarking, but I kinda expect compilers to begin melting down with more complex grammars or longer input strings. For what it's worth, the above example compiles in only a couple of seconds on VC++2008. I'll probably write something up about this soon and maybe send off an RFC to the boost list at some point. Comments? To be honest, I wasn't sure whether to post this here or in the coding horrors thread
|
# ? Jul 8, 2009 02:22 |
|
I'm writing a small program in C/C++ and had a question regarding a compiler error. I wanted to create a separate file that handled the task of setting up parameters, flags, definitions and variables for my program, as well as performing one-time tasks. I wrote a .cpp file and included the Setup() method call, and then simply called it in main. The error reports: "multiple definition of Setup()", "main.cpp: first defined here." I simply changed the entire function to an inline function to avoid the error, which works. However, is this a proper way to handle things? It feels like there should be a better or more common way of doing this without having to inline a rather large function, especially since it feels like I'm avoiding the compiler when it's trying to warn me. Of course, it's only ran once during the programs lifetime, and it's not HUGE, so I'm not worried about performance impact, but it still feels like a rather poor method of getting it to work. Is there a better/smarter/easier way of doing this?
|
# ? Jul 8, 2009 19:12 |
|
That's a linker error which is caused, well, by the function being defined more than once. Don't put the function definition in a file you #include from others unless you want to inline it but rather put its definition in its own translation unit and include its declaration/prototype from all the files that need to call it.
|
# ? Jul 8, 2009 19:18 |
|
It's good to know that some days I'm an idiot. This problem was bothering me because it seemed simple enough, but I thought I was missing something. What I was missing was coffee. Problem resolved.
|
# ? Jul 8, 2009 20:49 |
|
If I've got this:code:
|
# ? Jul 12, 2009 20:09 |
|
No because Foo isn't a class.
|
# ? Jul 12, 2009 20:14 |
|
I thought that considering Bar will be the same for whatever type Foo is instantiated with that an exception might have been made for it or something.
|
# ? Jul 12, 2009 20:39 |
|
|
# ? May 23, 2024 01:27 |
|
You'd start to get inconsistant behaviour (or atleast inconsistant with the behaviour of C++ template class specializations as being different classes) if two different specializations of Foo both try to use Bar separately.
|
# ? Jul 12, 2009 21:39 |