|
Eararaldor posted:I'm not entirely sure if this is the right place to post this From the list of megathreads, you want the .Net (C#, VB.NET [VB 2003, 2005, and 2008]) Questions Megathread megathread.
|
# ¿ Mar 7, 2008 15:17 |
|
|
# ¿ May 4, 2024 04:34 |
|
Aside from the Dragon book, I would also recommend Modern Compiler Implementation in Java by Appel (or ML or whatever the other one is)
|
# ¿ Apr 6, 2008 16:07 |
|
For starters, populate() takes a 1-D array and you're passing it a 2-D array
|
# ¿ Apr 17, 2008 13:01 |
|
What toolkit are you using for the graphics? How are you trying to save it?
|
# ¿ Apr 28, 2008 04:17 |
|
Viper2026 posted:For some reason, the cout statements in this portion of my code are not printing anything: Depending on the platform and the stream settings, cout won't flush (print its buffer) until it encounters whitespace. Now changing that or manually flushing it, that I don't remember
|
# ¿ Apr 30, 2008 04:44 |
|
Sarah Sherman posted:Now, the probability shouldn't get above one at all. Why is it getting up to around 6? The problem's in the loops in main(). You're incrementing num_matches multiple times per trial. It only needs to be incremented once per trial, because once two people share the same birthday, the trial is a match and you can stop checking.
|
# ¿ May 12, 2008 03:17 |
|
HB posted:Looks like numMatches is not getting reset properly either. So it just adds the match onto all the matches from all previous trials. That part looks fine (numMatches = 0 in the outermost loop), the formatting's kind of bad though. edit: quote:The if statement on line 72 doesn't have brackets, so only the first statement following it is affected by the if. You've got two lines indented there, so I'm not sure if you meant for both of those lines to be in the if's body. Seriously, fix the formatting and always use braces
|
# ¿ May 12, 2008 03:23 |
|
TheBlackRoija posted:when I try to compile it a get a whole bunch of "'WORDS' undeclared (first use in this function)" errors Tell us what compiler you're using, what OS (and version) you're compiling on, and copy-paste the exact errors you're getting.
|
# ¿ Jun 12, 2008 16:19 |
|
greatn posted:
I don't think you mean this. Also number should be declared with size 4, and the last entry set to '\0'
|
# ¿ Jul 3, 2008 21:54 |
|
e: IGNORE ME
|
# ¿ Jul 28, 2008 21:59 |
|
FearIt posted:I'm trying to find all the handles of windows with a certain class type. FindWindow() only seems to return the first, how would I get the rest? Use EnumWindows, like Pooball said, and GetClassName in the EnumWindowsProc to determine if the window is the class you want.
|
# ¿ Sep 11, 2008 22:21 |
|
The linker is saying it can't find Utility::Void. If the Void method is defined in the class Utility, you need to declare that as part of the method signature:code:
|
# ¿ Oct 14, 2008 02:16 |
|
Avenging Dentist posted:just use Visual Studio which will leave the command prompt open anyway. only if you run the program without debugging. If you start it using the debugger, it'll close on exit. It's unfortunate but true
|
# ¿ Oct 14, 2008 04:26 |
|
PT6A posted:I'm having a hard time understanding how malloc'd memory is freed: I understand you can free it explicitly with free(), but I've seen contradicting information as to whether a malloc'd piece of memory that's being pointed to is freed when the program terminates. So, do I have to call free() for everything, or just in case I want to change the pointer that points to the malloc'd memory? Any memory claimed by a process is reclaimed by the operating system when it terminates, but that's not the point of free() anyway. free() is used to dispose of memory your program isn't using anymore while it's running. As soon as you're done with a block you got from malloc(), free() it. e: gently caress, a whole other page
|
# ¿ Oct 23, 2008 15:22 |
|
How do Entity and RenderableEntity relate? Unless it's RenderableEntity : Entity, that cast won't work - if it is, you don't need multiple inheritance on MeshInstance.
|
# ¿ Nov 6, 2008 17:05 |
|
IShallRiseAgain posted:I am having trouble transferring an image object to a class using the get set method. I keep getting a null reference error. 1. This is C#, not C or C++. Put this in the C# megathread. 2. Use the debugger. What exactly is null when that exception happens?
|
# ¿ Nov 17, 2008 16:18 |
|
I've got an MFC-based .lib, and for the life of me I was sure there was some tool that came with Visual Studio that could show me what symbols it is exporting. Am I smoking more crack than usual and making this tool up? If I am hallucinating, what's a tool that can show me its exports?
|
# ¿ Nov 28, 2008 17:49 |
|
The answer is probably "no," but I thought I'd ask anyway: Is there a way to tell Visual Studio's linker, when it encounters a multiply defined symbol, which one is the "right" one? The scenario is sort of asinine. Our company's application is MFC-based, v2.5 I believe, and we're having trouble throwing exceptions through it. Most of the time this is handled by a redefined AfxWinMain that handles our application's exception class - which is not derived from CException. We're getting some odd activation context exceptions in certain scenarios when an exception is thrown from a window's OnCreate handler. The architect working with me on this thinks the band-aid solution is to redeclare AfxCallWndProc to be able to handle our exceptions as well as CExceptions, but that is proving difficult because AfxCallWndProc isn't declared as extern by MFC. AfxWinMain is one of only a handful of externs in MFC, as far as I can tell, and none of the others have dick to do with the problem. So yeah, any way to force the linker to accept a specific location of a symbol as The Symbol?
|
# ¿ Dec 17, 2008 19:46 |
|
ehnus posted:Have you tried decorating the symbol with __declspec(selectany)? The symbol here is a method, AfxCallWndProc(CWnd*, HWND, UINT, WPARAM, LPARAM). selectany seems to only apply to data - trying it, I get "'selectany' can only be applied to data items with external linkage"
|
# ¿ Dec 17, 2008 20:11 |
|
rjmccall posted:No. Indeed. Ever notice how top doesn't show the number of cores?
|
# ¿ Dec 18, 2008 06:56 |
|
hexadecimal posted:Is endl OS specific or does it only add '\n' not "\r\n" on Windows in addition to flushing? In text mode output streams on Win32, \n is automatically expanded to \r\n
|
# ¿ Jan 8, 2009 15:59 |
|
MFC question: Is there any way to render a CTreeCtrl with expand/collapse boxes and no treelines? TVS_HASBUTTONS evidently only works if TVS_HASLINES and TVS_LINESATROOT are also supplied edit: Never mind, it does what I want with only TVS_HASBUTTONS | TVS_LINESATROOT, VS just didn't recompile the most recent changes to my resource file.
|
# ¿ Jan 13, 2009 20:37 |
|
On Windows it'll only block the thread. This is why you do blocking I/O or heavy processing in a thread other than the UI thread, so the UI remains responsive to input while blocking is happening. Windows threads are kernel threads, I'm not sure how user threads (like pthreads on Linux) work.
|
# ¿ Jan 19, 2009 20:54 |
|
Standish posted:Linux pthreads are kernel threads too (or to be more exact, the Native Posix Thread Library which is the default implementation of the pthreads API on any non-ancient Linux is kernel-thread-based, and so was the LinuxThreads library which preceded it.) Whoops, maybe I meant GNU Portable Threads. It's been several years since I did any Linux development
|
# ¿ Jan 19, 2009 22:14 |
|
more falafel please posted:On a related note, why would an app take ~5 times as long to load in the debugger as outside it? It might have something to do with the debugger attempting to load symbols for every module loaded by your application, which of course would not happen outside the debug environment. If you're set up to pull Windows symbols from the Microsoft symbol servers automatically instead of on-demand, that process can take a really long time.
|
# ¿ Feb 16, 2009 21:52 |
|
Did you explicitly add the library to the Linker -> Input properties?
|
# ¿ Apr 14, 2009 20:35 |
|
Morton the Mole posted:Also you have shittons of unnecessary whitespace and brackets, but to each his own. And your indenting sucks, but that's an objective observation and not a "to each his own" thing.
|
# ¿ Apr 23, 2009 05:35 |
|
Is #pragma once universally supported? My company's coding standard says to not use it because we compile on a whole mess of platforms and compilers, though it's entirely possible that that's out of date.
|
# ¿ Jun 8, 2009 14:41 |
|
This might be a crazy idea, but here goes. I've got a VS 2008 solution with fourteen or so C++ projects in it, all of which get statically linked together into a single executable. Each of the fourteen projects has a string table. The VS string table editor is not aware of other projects in the solution and will happily let you create duplicate IDs that are only found when the resources are compiled together (the final .exe project includes the other projects' resources into its own). This late-notice collision is not cool, and our resource IDs are fragmented enough that it happens pretty much every time one of the developers adds a new string to any project. One of my teammates and I got to talking today, and we wondered if there is a sane way to generate string ID numbers at compile time rather than design time; that is, convince the resource compiler - or some prebuild process - to collate the existing string tables and reassign non-colliding IDs once all the strings are known. This would result in string IDs [potentially] changing in each endstate image, but that shouldn't be a problem...right? There are probably dozens of reasons that make this a terrible idea. For one thing, the VS string table editor wouldn't know what the gently caress, which probably will make localization difficult - I don't know the exact localization process that our company uses, only that we contract out to have it done. What I'm looking for is: a) reasons this is stupid so I can focus my unused energy somewhere more useful b) ways this might work at all, just so I can play around with it It probably won't end up being valuable to anyone, but I think it's an interesting thought exercise and I'm sort of underscheduled this month
|
# ¿ Jun 30, 2009 02:26 |
|
quadreb posted:I don't know poo poo about Visual Studio, but why not just make an internal registration database keyed to the IDs that each developer drops their IDs into. Hell, you could even just do it as a wiki page. I'm really not sure what you're suggesting with this...
|
# ¿ Jun 30, 2009 02:48 |
|
quadreb posted:I'm suggesting a process to self-regulate the assignment of new ID numbers. VS already autoassigns the IDs numbers, which is the problem because it does so stupidly I'm looking for a new process to autoassign at a different point in the cycle. e: Even if the string table designer did understand multiple projects in a solution and could autogenerate IDs that don't conflict within a single solution, that doesn't help when multiple instances of VS (many developers) are generating the same IDs. e2: I should mention that resource IDs are two-byte unsigned integers. csammis fucked around with this message at 14:24 on Jun 30, 2009 |
# ¿ Jun 30, 2009 03:49 |
|
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 |
|
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 |
|
Contero posted:Why can't switch look something like this: How does your syntax handle fall-through? code:
|
# ¿ Aug 25, 2009 22:59 |
|
Contero posted:Well it doesn't, but I'd argue that fall-through is lame anyway. You're right, two comparisons are better than one! And what AD said about this being why switch statements are useful in the first place.
|
# ¿ Aug 26, 2009 00:42 |
|
Maybe reinterpret_cast was feeling underrepresented in his codebase?
|
# ¿ Sep 24, 2009 19:45 |
|
ultimateforce posted:My problem is that I keep getting the same random numbers each time. That isn't the only problem with what you posted, but I'm going to guess that you never seed the random number generator in the code you aren't showing us.
|
# ¿ Nov 5, 2009 00:58 |
|
Dijkstracula posted:Also, http://beej.us/guide/bgnet/ or better yet, http://www.unpbook.com/ Goddamn you, for a minute I was excited about a website I could direct socket questions to that was better than Beej (which is great)
|
# ¿ Nov 12, 2009 22:58 |
|
Nigglypuff posted:what would be the idiomatic, non-idiotic contraction of "·emits a warning at compilation" "emits a warning" because obviously it's at compile time
|
# ¿ Nov 20, 2009 16:20 |
|
|
# ¿ May 4, 2024 04:34 |
|
litghost posted:Read the documentation and look at the examples. And then hit up the C# thread.
|
# ¿ Dec 5, 2009 17:42 |