|
Remulak posted:I'm trying to think about cross-platform Windows/Mac compatibility for a the backend of a new project I've been working on. It's not a horribly complex project, since it's just a common C++ backend to a client that will have its own native frontends, but drat it's hard to figure out a good cross-platform way of doing things I'd normally lean on an MS API for. For accessing the contents of a zip file, you could try zziplib or PhysicsFS. Doc Block fucked around with this message at 06:54 on Feb 17, 2008 |
# ¿ Feb 17, 2008 04:19 |
|
|
# ¿ Apr 19, 2024 21:40 |
|
Jo posted:I've heard performance takes a serious hit when it comes to using immediate mode (a la glBegin() and glEnd()) versus using display lists. Yeah, display lists are faster. The fastest way, however, would be vertex arrays or VBOs.
|
# ¿ Feb 18, 2008 02:32 |
|
NM, reposting in Mac dev thread.
Doc Block fucked around with this message at 15:12 on Feb 19, 2008 |
# ¿ Feb 19, 2008 14:41 |
|
freddy-10eighty posted:I'm currently taking an intro to C++ at my uni.... can anyone tell me how to compile and run C++ files on a mac? I've tried using XCode, and it's a bit overwhelming since I'm still new to this...basically, when I write code, compile and build in MS Visual studio, a console window pops up and allows me to test out my program, but the same thing doesnt happen with XCode...nothing pops up. It's a difference between the way Windows and Unix systems (including OS X) work when it comes to command-line vs GUI apps. If you want to see your program's output, open up Terminal.app (it's in /Applications/Utilities), cd to yourprojectdir/build/(Release or Debug)/yourproject.app/Contents/MacOS and then type ./yourproject to run it. Or, for simple little CLI programs don't bother with a big IDE like Xcode and just run g++ from the command-line. Doc Block fucked around with this message at 11:29 on Feb 21, 2008 |
# ¿ Feb 21, 2008 09:23 |
|
If GCC can find stdlib.h but isn't linking in all the functions from the C standard library then something is wrong with your setup. You shouldn't need any extra command-line options to get the stuff in stdlib.h to work.
|
# ¿ Feb 21, 2008 15:59 |
|
putchar and getchar only do one character at a time and don't do any format conversion. For example: code:
Doc Block fucked around with this message at 20:50 on Feb 22, 2008 |
# ¿ Feb 22, 2008 20:45 |
|
You downloaded and installed the platform SDK, right? And followed Microsoft's instructions on how to set up VS Express to use it and have the ability to create Win32 apps, right? That should be all you need to utilize the Win32 API (Win32 API != MFC). You would still lack a resource editor, but IMHO it would be far better to use VS Express and suffer without a resource editor than to go back to VS 6.0.
|
# ¿ Feb 29, 2008 12:37 |
|
What's a good book for learning modern C++? I have both volumes of Thinking in C++, but they're pretty old. I haven't written any C++ in a long time, but will probably have to write something in C++ soon, and the problem is that I only half remember the language and the STL. I can reread Thinking in C++ if need be, but I'd prefer something that also incorporates the new C++11 and C++14 stuff. Any suggestions? edit: none of the books listed in the OP look like they cover C++11 & C++14, at least not in any currently-shipping edition. Doc Block fucked around with this message at 06:24 on May 14, 2015 |
# ¿ May 14, 2015 06:21 |
|
Are you on Windows? Try changing the read mode to "rb" and the write mode to "wb".
|
# ¿ May 21, 2015 08:19 |
|
edit: tl;dr It has to do with Windows line endings being different than Unix line endings, and thus not being the same as C's newline character ('\n'). Microsoft's C standard library converts between the two when reading/writing text files so that Windows C programs can still just treat line endings in text as the single '\n' newline character instead of having to use "\r\n". The "b" modes ("rb", "wb", "rwb", "ab") were created to tell the stdlib that it's dealing with a binary file and not to do any newline conversion. Microsoft's C++ standard library implementation does the same thing AFAIK. If you're reading/writing binary files using the C standard library (fopen(), fread() etc.) then use "rb", "wb", "rwb", or "ab" in case somebody ever runs your code on Windows. Or, if you're using C++ and iostreams, make sure to specify the std::ios::binary flag. Doc Block fucked around with this message at 10:25 on May 21, 2015 |
# ¿ May 21, 2015 10:02 |
|
Or just change directory at run-time to the "codebase" directory. You could have it be passed in as an argument that, if present, the executable will change to the specified directory. That way, for testing/debugging within VS you can have it change to the "codebase" directory, and then for shipping you can just copy the release executable to the copy of "codebase" that you're shipping.
Doc Block fucked around with this message at 18:05 on May 31, 2015 |
# ¿ May 31, 2015 18:03 |
|
You also have the problem of doingC++ code:
when it should be C++ code:
or even just C++ code:
since n is guaranteed to be less than 100 if control reaches the else if statement.
|
# ¿ Jun 9, 2015 04:17 |
|
They might have just parsed out the 80-bit format. Or it might be the size of the largest float the old non-Intel Mac FPU could do, like the x87 FPU did.
|
# ¿ Jul 9, 2015 15:15 |
|
I have a kinda weird question: why do so many C++ developers make their for loops use prefix increment instead of postfix increment? In other words, why do they use ++i instead of i++? Like,C++ code:
C++ code:
I'm an Objective-C programmer, and I almost never see prefix increment in Objective-C or C code, and I don't recall it being used terribly often when I first started using C++ back in the early 2000s, but now that I'm trying to re-learn C++ I see it quite often in online C++11 examples and such.
|
# ¿ Jul 22, 2015 16:57 |
|
I see, thanks. Having to get used to a language where class instances can be created on the stack and iterators are separate objects is kinda weird after so many years of writing Objective-C. Does the C++ compiler have to create temporary variables even for integer indexes? Like, when compiled without optimizations, is there still a difference between C++ code:
C++ code:
edit: With integer indexes, clang seems to generate the same code for prefix and postfix. Gonna be different for iterators though, thanks for the info. Doc Block fucked around with this message at 18:14 on Jul 22, 2015 |
# ¿ Jul 22, 2015 17:58 |
|
Just another argument against operator overloading, heh
|
# ¿ Jul 22, 2015 19:12 |
|
fritz posted:
|
# ¿ Sep 4, 2015 07:12 |
|
Xarn posted:Can someone explain that to someone lucky enough to get started with git as source control? CVS is old and terrible, and there's absolutely no reason to use it these days; there's Subversion if you need/want a centralized version control system that's open source and non-awful. That they're using CVS says a lot of terrible things about their project. Never mind that they're hosting it on a Free Software version of SourceForge.
|
# ¿ Sep 4, 2015 19:04 |
|
hackbunny posted:CVS is a positively ancient revision control system. How bad is it, really? Revision numbers are per-file, forget atomic commits. Forget history-preserving moves and copies in fact. Good luck bisecting, without atomic commits you have to work with loving timestamps. Good loving luck branching and merging. Can't even delete directories, the client has an option to automatically clean up empty directories. Advantages (or: how worse could it have been?): unlike its predecessor, RCS, it's client-server Fun fact: CVS uses RCS for the actual versioning, which is why it's per-file, and also why it can silently corrupt your version history.
|
# ¿ Sep 4, 2015 19:07 |
|
Swift still has operator overloading.
|
# ¿ Sep 23, 2015 16:37 |
|
JawKnee posted:Hmm, yeah it appears so. So many deprecated functions! Nothing in your shader accesses the fixed-function matrices anyway. Compute the matrixes you need on the CPU, since you typically only need to change them once per frame, and sometimes even less often than that (like the projection matrix), and pass them into your vertex shader as uniforms. That way you aren't recomputing them for every vertex. Pass in the modelViewProjection matrix, plus occasionally the model matrix and/or viewProjection matrix and a normal matrix depending on what lighting effects etc you're going for. And you'll save yourself a lot of headaches in the future of you learn the difference between the model, view, and projection matrix (and why the OpenGL fixed-function pipeline combined the model & view matrices into one modelView matrix). I speak from experience
|
# ¿ Oct 31, 2015 23:29 |
|
PRADA SLUT posted:I noticed that after. It still outputs correctly. Which is purely accidental.
|
# ¿ Feb 1, 2016 09:21 |
|
If you want just C then I think your options are GTK and, uh... Motif?
|
# ¿ Feb 29, 2016 00:05 |
|
Ciaphas posted:The difference seems to only matter on systems where the file position isn't necessarily equal to the character count for text data. Are these some arcane platforms where this happens, or is this referring to Unicode data, or what? I only ever deal with ASCII or pure binary (mostly the latter) in my work so Unicode is just a word to me. Isn't it mostly because on Windows the C runtime translates the \r\n into just \n when reading files opened in text mode, and vice-versa when writing, because Windows uses CR+LF for newline instead of just LF? I remember being bitten by that years ago when trying to port some code written for Linux to Windows that sloppily opened all files in text mode, regardless of whether they were text or binary. edit: and also for mainframe operating systems and their weird character sets too, I guess. Doc Block fucked around with this message at 04:47 on Mar 1, 2016 |
# ¿ Mar 1, 2016 01:52 |
|
bollig posted:So as I understand it, if it's char *, it's just in memory aaaand immutable, I think. Whereas char[] is an array with characters as the elements. char * is a pointer to a char, that's all, but is usually understood to be a pointer to an array of chars (such as a NULL-terminated string). When it comes to function arguments, char[] is basically the same thing, only you're being more explicit in your code about what the intent is: you want an array of chars. Either can be used to pass a char array, and in fact pretty much every C function that takes a string will take a char * or const char *. I forget what the exact term is, but passing an array in C results in it devolving into a pointer and the pointer being passed instead. Such as: C code:
Doc Block fucked around with this message at 18:06 on Mar 18, 2016 |
# ¿ Mar 18, 2016 18:03 |
|
|
# ¿ Apr 6, 2016 05:13 |
|
It's probably pretty common for open world games and such to keep one or more background threads spun up that just handle loading data and streaming it to the GPU or whatever.
|
# ¿ May 12, 2016 06:29 |
|
Try naming it LAST_VALUE or something so at least people don't have an excuse for adding things after it?
|
# ¿ May 23, 2016 03:00 |
|
Are they really? LMFAO
|
# ¿ May 23, 2016 04:26 |
|
If your application is GPL or LGPL (OP said it's an open source application), then I don't see why you couldn't just put the class files in your project and call it a day. "Users" will still be able to swap out the KDE stuff with a newer version or whatever since the source will be available, etc edit: has anyone ever actually swapped out a .DLL or .framework or whatever of an LGPL library that shipped with a closed-source application? Doc Block fucked around with this message at 15:08 on Jun 2, 2016 |
# ¿ Jun 2, 2016 15:05 |
|
leper khan posted:Because the GPL is a legal virus that you may not want your code infected with? You can't just copy pasta code like that without thought. Yes, I'm aware of that, which is why I said if his application was going to be licensed under the GPL or LGPL. He mentioned right there in his first post that he was going to make his application open source. Now that he's said he wants to license it under MIT then yeah, obviously, he can't just copy/paste the files without serious legal consideration.
|
# ¿ Jun 3, 2016 09:47 |
|
I saw some JavaScript (I think?) code where the programmer had done the equivalent of something like:code:
I recall also seeing stuff where they would do if(!(!thing)) for the same dumb reason. The moral of the story: just compare against what you're trying to compare against. So if you want to test if a float is nonzero, just do if(f != 0.0f) or if(f) or whatever. Doc Block fucked around with this message at 08:48 on Aug 8, 2016 |
# ¿ Aug 8, 2016 05:18 |
|
Yeah, I can understand doing !!integer as a short way to force an integer value to be 0 or 1, or if for some weird reason you really needed the comparison to be against 0 or 1 instead of zero/nonzero, but I was more poking fun at cargo cult web developers doing it needlessly in comparisons, like if(!thing == false) instead of just if(thing) because somehow doing a "true boolean comparison" (a thing a web developer actually told me) was somehow better or faster. Guess it was only tangential to the point, which was that the OP should just write if(!myFloat) or if(myFloat == 0.0f) and be done with it, as opposed to trying to micro-optimize it or casting it to a bool first as a hint to the compiler etc. etc. etc. Doc Block fucked around with this message at 08:56 on Aug 8, 2016 |
# ¿ Aug 8, 2016 08:44 |
|
When it comes to JavaScript, who knows? vv But at True Boolean ComparisonTM. Even if that really is a faster/better way of doing it in JavaScript, I got the distinct impression he was just cargo culting.
|
# ¿ Aug 8, 2016 14:46 |
|
Using glib even on *nix should be grounds for being fired (or kicked off the open source project). Does it still call abort() when it encounters an error?
|
# ¿ Aug 18, 2016 17:27 |
|
Click on a line number to set a breakpoint on that line in Xcode. Clicking on the little breakpoint arrow that appears over the line number will leave the breakpoint there but disable it (click on it again to re-enable); right click on it to bring up a contextual menu that will let you completely remove that breakpoint.
Doc Block fucked around with this message at 05:36 on Aug 19, 2016 |
# ¿ Aug 19, 2016 05:30 |
|
You've built a 64-bit x86 slice (OS X allows multiple archs in the same binary), but either haven't linked everything to that slice (IDK if that's even possible) or you've got some prebuilt libraries you're linking against that don't have x86-64 slices.
Doc Block fucked around with this message at 23:07 on Sep 3, 2016 |
# ¿ Sep 3, 2016 23:04 |
|
raminasi posted:I just checked the prebuilt binaries with file, and it says "Mach-O 64-bit dynamically linked shared library x86_64," so I think I've got the right architectured ones, anyway. I also dumped the symbols of one of them with nm, but I can't really tell whether there are matches or not because ld gives me de-mangled symbols and nm gives me mangled ones. There are definitely plausible match candidates. I feel like there's just some stupid switch I need to set that I forgot about but I'll be damned if I can figure out what it is. The error message you got specifically means that the linker can't find all the necessary symbols to link the x86-64 binary slice, which means something isn't getting compiled for x86-64. You should be able to look at the list of missing symbols and figure out what library or whatever they're supposed to come from, then check that to make sure it's getting built for x86-64.
|
# ¿ Sep 4, 2016 04:59 |
|
raminasi posted:Yes, that is what I did, and they are, assuming that's what that output from file means. Is it actually getting linked against those libraries, then? Is every symbol from that library missing, or just some of them? I wouldn't think them being dynamic libraries would affect compile-time linking unless the linker can't find them (or isn't being told to link to them).
|
# ¿ Sep 4, 2016 19:49 |
|
|
# ¿ Apr 19, 2024 21:40 |
|
Yeah, CMake isn't the same thing as make. CMake is so you can generate project files for many different build systems, such as VS, Xcode, and makefiles for Linux etc.
|
# ¿ Sep 8, 2016 15:36 |