Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Fecotourist
Nov 1, 2008
std::valarray and its slices handle all your row/column business pretty neatly, and don't need tr1.

Adbot
ADBOT LOVES YOU

Fox1
Apr 30, 2004

by Fluffdaddy
Hey, fairly new to C++, having trouble getting to grips with reading from external files.

My problem:
I want to store a .txt dictionary file in my trie data structure.
I have created the trie class, and the function to add words prototype(?) is like so
code:
void trie::insert_word(char* s)
I can successfully add words using a char[] that looks like so
code:
char *s[] = {"hello","this","is","how","we","add","words"};
    for(int i=0;i<sizeof(s)/sizeof(*s);i++)
    {
        mytrie.insert_word(s[i]);
    }
inside the insert_word function there is a "while *s is not '\0'" loop to determine end of words, and we cycle through letters using *s++

I have a txt file which is an entire dictionary with 1 word per line. I've tried various methods to add these words to the char[] but it never works, and my knowledge of c++ is limited. Anyone got any ideas?

UraniumAnchor
May 21, 2006

Not a walrus.

Fox1 posted:

I have a txt file which is an entire dictionary with 1 word per line. I've tried various methods to add these words to the char[] but it never works, and my knowledge of c++ is limited. Anyone got any ideas?

If you're using C++, you should use ifstream and getline(stream, string) to read a flat text file, generally speaking. Any reason you're using char * instead of string?

Something like this: (I may have the syntax wrong as I'm going off memory, and this does not check for blank lines or lines that contain more than one word)

code:
ifstream infile("file.txt");
string line;

while(getline(infile,line)) {
   trie.add(line);
}

Fox1
Apr 30, 2004

by Fluffdaddy
Because the trie structure is a linked list of single chars, making a tree for my lexicon.

It is part of a scrabble AI, eventually the trie will be traversed to look for valid words that can be made from the board and the players rack. I don't think it can be done with strings because of how words can be made in scrabble (combo of rack and board letters)

nielsm
Jun 1, 2009



Even if you're going to be storing the strings in a tree you can just as well work with STL strings instead, if only for the simplified memory management. If your tree insertion function will still be simpler when done with char pointers (it might be) you should still be using the string type when reading the file, IMO, and then just get the const char * pointer to the string's storage (with the string::c_str() function) for passing into the tree.

Fox1
Apr 30, 2004

by Fluffdaddy
Ok, c_str() looks promising actually, I will have a play with that.

Princess Kakorin
Nov 4, 2010

A real Japanese Princess
No clue if this is the right place, forgive me if it is wrong!

I'm not asking for someone to do my homework, I'm asking for someone to explain why this isn't working and provide a solution

I've run into a rut with my code for a project, and it's driving me insane because I did similar things in previous programs and they all worked fine.

Here's my problem:

I have an object O, and a pointer P that points to O.
I now link P with other pointers, and those pointers with pointers. A big ol' linked list.
However, when I check out O, O is not linked with anything. What am I doing wrong?

Here's the dirty stuff

Main.cpp
code:

#include "binary_tree.h"
#include <iostream>

int main()

{
	int d=0; //Just used to keep my program alive
	tree myTree; //Binary tree object
	tree *pTree = new tree; //Binary tree pointer object
	*pTree = myTree; //Point to the tree object

	pTree->addLeft(); //Attach a new tree object to the left leaf
	myTree.getLeft(); //Go to the new left leaf
	


	std::cin>>d; //Welcome to die

	return 0;
}
Tree.cpp
code:

tree::tree()
{
  left = NULL;
}

void tree::addLeft()
{
        //Make a new tree object
	tree *newTree = new tree;
        //Set the current left to point to the new tree.
	left = newTree;

}


void tree::getLeft()
{
        //If your left exists
	if(left!=NULL)
	{
                //Become the left and let us know.
		*this = *this->left;
		std::cout<<"Moved left.\n";
	}
        //Or not.
	else { std::cout << "At the end.\n";}

}
Tree.h
code:
#include <string>

class tree
{
public:
	//Constructor
	tree();
	//Destructor
	~tree();

	//Attaches a "leaf" node to the left or right
	void tree::addLeft();
	void tree::addRight();

	//Moves to the left or right
	void tree::getLeft();
	void tree::getRight();

	//Swaps the leaf with a new leaf.
	void tree::swap();


private:

	tree *left;
	tree *right;
	tree *root;
	std::string data;

};


nielsm
Jun 1, 2009



Princess Kakorin posted:

Main.cpp
code:
	tree myTree; //Binary tree object
	tree *pTree = new tree; //Binary tree pointer object
	*pTree = myTree; //Point to the tree object
That's not how pointers or the dereferencing operator work.

First you create an auto-allocated tree object, which means it'll be allocated on the stack.
Then, you declare a pointer to a tree, allocate a new tree object on the heap with operator new. You now have two tree objects, one on the stack and one on the heap.
Finally, you assign the tree on the stack to the tree on the heap. This copies the contents of one tree object into the other, it does not make the pTree variable point to the stack-allocated tree.
What you meant to do:

code:
tree myTree; // auto-allocated tree object
tree *pTree; // unassigned pointer to a tree object
pTree = &myTree; // take the address of myTree with the unary operator & and assign it to the pointer
The unary operator & creates a pointer to an already existing value. The unary operator * dereferences one level of indirection. (It's worth noting that using operator & on a pointer gives you a pointer to a pointer.)

Lastly, in your original code, you leak a single tree object, the one you heap allocated with operator new, since you never delete it.

E: Wait, your tree class also looks very strange. I don't think it sounds like a good idea to have a mutable tree object that walks its own children. You should separate the representation of the tree itself from the walking of it.
E2: Okay maybe it is technically possible to do as you're trying to do, and in that case what you're doing in your main() would be correct, but it still looks like a bad idea to handle trees in. Tree algorithms are usually implemented recursively or using an explicit stack or queue to walk the trees, and your way of having a mutable tree objects complicates this. Is there any specific reason you're doing like this?

nielsm fucked around with this message at 21:15 on Apr 14, 2011

Princess Kakorin
Nov 4, 2010

A real Japanese Princess

nielsm posted:

That's how how pointers or the dereferencing operator work.

First you create an auto-allocated tree object, which means it'll be allocated on the stack.
Then, you declare a pointer to a tree, allocate a new tree object on the heap with operator new. You now have two tree objects, one on the stack and one on the heap.
Finally, you assign the tree on the stack to the tree on the heap. This copies the contents of one tree object into the other, it does not make the pTree variable point to the stack-allocated tree.
What you meant to do:

code:
tree myTree; // auto-allocated tree object
tree *pTree; // unassigned pointer to a tree object
pTree = &myTree; // take the address of myTree with the unary operator & and assign it to the pointer
The unary operator & creates a pointer to an already existing value. The unary operator * dereferences one level of indirection. (It's worth noting that using operator & on a pointer gives you a pointer to a pointer.)

Lastly, in your original code, you leak a single tree object, the one you heap allocated with operator new, since you never delete it.

Ah, well I was going to delete it after I got everything handled.
Now, I've tried to do the &myTree, but when I populate P and do the getNext and everything using pTree and go back to myTree, myTree is exactly where pTree is.
I'm probably being dumb right now, with 3 weeks left in the semester my brain is dead. Any idea on how to return myTree to the top without creating another function to have me scale all the way back up? Because then having the pointer is pointless(Haha! puns.), and I was hoping to save time by just using the pointer to add the data without having me have to scale back to the top.


Edit: I didn't see your edits, I should probably explain the project some more. I'm supposed to make an "intelligent" 20-questions game using a binary tree, and if it can't figure it out it asks the user to tell it what it is, and a question associated with it, which it will then insert. Because of this, I figured it'd be simpler to create the tree and a pointer to the tree, and just populate and scale with the tree, and delete the pointer when I'm done.
Like I said, I'm probably being dumb(No, I know I am because I keep comparing a binary tree to linked lists, which is why I'm trying to put this pointer in.) Should I just suck it up and do it recursively?

Princess Kakorin fucked around with this message at 21:20 on Apr 14, 2011

wellwhoopdedooo
Nov 23, 2007

Pound Trooper!
There's a couple of things about the way C/C++ is normally written that I think really hurts initial understanding.

code:
int *hay;  // Why are we attaching the * to the variable name?
           //   We don't later refer to it as *hay unless we're
           //   dereferencing.
int* derp;  // This is much clearer--the type of the variable is
            //   int*.

// Wait, what's const here? The int is const?
void someFunction (cont int *wtf);

// But what about this? Now the pointer's const? Nope! Still the
// int.
void someOtherFunction (int const *wtf);

// Ok, so the int is still const, right? Nope! _Now_ the pointer
// is const.
void yetAnotherFunction (int *const christ);

// What the gently caress is going on here?
void goodLord (const char *const uh);

// Simple (if goofy) rules: const modifies the thing to its immediate
// left. Pointer  type is attached to the type, since it's, setting
// the type, and has nothing to do with the name.
void hereWeGo (char const* const phwew);
I could never, ever, wrap my head around the actual rules used to determine exactly what was const, a *, etc., until I read Stroustrup's rant in his C++ book.

nielsm
Jun 1, 2009



wellwhoopdedooo posted:

There's a couple of things about the way C/C++ is normally written that I think really hurts initial understanding.

code:
int *hay;  // Why are we attaching the * to the variable name?

Because this line declares one int pointer and one int:
code:
int* foo, bar;

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

nielsm posted:

Because this line declares one int pointer and one int:
code:
int* foo, bar;
Which is stupid too! Perhaps even stupider!

wellwhoopdedooo
Nov 23, 2007

Pound Trooper!

roomforthetuna posted:

Which is stupid too! Perhaps even stupider!

Yeah, that was in Bjarne's rant too. It's been so long since I've declared multiple variables on one line, I completely forgot about that.

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

wellwhoopdedooo posted:

Yeah, that was in Bjarne's rant too. It's been so long since I've declared multiple variables on one line, I completely forgot about that.
Relatedly, I suddenly realize perhaps why Microsoft has all those stupid "LPSOMETHING" pointer typedefs.

Paniolo
Oct 9, 2007

Heads will roll.
Is there anything like boost::array where you can specify the size on construction, and then it's fixed? Looking for a container suitable for objects which are not copyable or moveable, but with minimum allocation overhead.

Also, is there anything similar to std::queue where the maximum size is specified as a template parameter (ala boost::array), with storage on the stack but a variable size? Bonus points if its push_back method accepts boost::in_place_factory for non-copy constructible types.

Paniolo fucked around with this message at 03:16 on Apr 15, 2011

TasteMyHouse
Dec 21, 2006

Paniolo posted:

Is there anything like boost::array where you can specify the size on construction, and then it's fixed? Looking for a container suitable for objects which are not copyable or moveable, but with minimum allocation overhead.
erm... Boost.Array is like that already?

e: oh you mean explicitly during construction and not as a template parameter.

VVVVV

TasteMyHouse fucked around with this message at 02:21 on Apr 15, 2011

Paniolo
Oct 9, 2007

Heads will roll.

TasteMyHouse posted:

erm... Boost.Array is like that already?

I should have clarified: by on construction I mean at run-time, not at compile-time, i.e. the maximum size as a parameter to either the constructor or an init() method.

TasteMyHouse
Dec 21, 2006
1. Why do you want this specifically? i.e. why is the template solution no good?

2. if you're doing it with a ctor, it is going to be inherently something done at run-time, so dynamic allocation is going to occur somewhere. you could fairly easily make your own class that wraps a call to new, and I think that's pretty about as good as you're gonna get anyway. Someone correct me if I'm wrong.

beuges
Jul 4, 2005
fluffy bunny butterfly broomstick

wellwhoopdedooo posted:

code:
int *hay;  // Why are we attaching the * to the variable name?
           //   We don't later refer to it as *hay unless we're
           //   dereferencing.
int* derp;  // This is much clearer--the type of the variable is
            //   int*.

I always write my code as int* x, and I hate the fact that pretty much every IDE does int *x instead. x is of type int*, so int* x makes infinitely more sense than int *x. I almost never declare multiple variables on the same line, and when I do, I don't mix ints and int*'s anyways. I wish there was an option in visual studio to change the default so that it makes more sense, instead of me having to change it manually afterwards.

BigRedDot
Mar 6, 2008

Amusingly, and probably because of how I write C++ references, I eventually split the difference and started writing
code:
int * foo
Been doing it for years now.

raminasi
Jan 25, 2005

a last drink with no ice

BigRedDot posted:

Amusingly, and probably because of how I write C++ references, I eventually split the difference and started writing
code:
int * foo
Been doing it for years now.

This is what I do too.

Edison was a dick
Apr 3, 2010

direct current :roboluv: only

GrumpyDoctor posted:

This is what I do too.

I used to. Then I had to change it because another project member said it made them think I was multiplying them.

It's not important why different styles were adopted.

Fecotourist
Nov 1, 2008
code:
int* a;
is retarded because somebody WILL come along and tack on another variable [and it's likely to be you]. This is why nobody does it the way you do.

And if you insist on thinking that way, you will NEVER understand function pointer declarations.

Fecotourist fucked around with this message at 04:21 on Apr 16, 2011

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

Fecotourist posted:

code:
int* a;
is retarded because somebody WILL come along and tack on another variable [and it's likely to be you]. This is why nobody does it the way you do.
And then the compiler will catch the mistake the moment you try to use the variable, OH NO!

I think the point of the complaint is not that it's a better representation of what the compiler does, it's that it's a better representation of what the programmer does, and is thus what the compiler should do. To clarify:
code:
// It is silly that these two aren't alike:
char* a, b;
LPSTR a, b;
// But these two are:
char* a;
LPSTR b;

quote:

And if you insist on thinking that way, you will NEVER understand function pointer declarations.
I prefer "int*" notation, and I understand function pointer declarations.

That Turkey Story
Mar 30, 2003

Fecotourist posted:

code:
int* a;
is retarded because somebody WILL come along and tack on another variable [and it's likely to be you]. This is why nobody does it the way you do.

And if you insist on thinking that way, you will NEVER understand function pointer declarations.

I really wish this were a troll.

that awful man
Feb 18, 2007

YOSPOS, bitch

wellwhoopdedooo posted:

There's a couple of things about the way C/C++ is normally written that I think really hurts initial understanding.

code:
int *hay;  // Why are we attaching the * to the variable name?
           //   We don't later refer to it as *hay unless we're
           //   dereferencing.

Because declaration mimics use. :eng101:

evensevenone
May 12, 2001
Glass is a solid.
When I was learning, I never really "got" pointers until I had a teacher that wrote them int*. But that is kind of a bad idea, because "int* foo, *bar" just looks dumb.

Honestly, the language should just be different. writing "int* foo" isn't good, but writing "int *foo" confuses learners.

clockwork automaton
May 2, 2007

You've probably never heard of them.

Fun Shoe

evensevenone posted:

When I was learning, I never really "got" pointers until I had a teacher that wrote them int*. But that is kind of a bad idea, because "int* foo, *bar" just looks dumb.

Honestly, the language should just be different. writing "int* foo" isn't good, but writing "int *foo" confuses learners.

This is where D gets it right.

code:
int* ptr1, ptr2;
Declares two pointers in D rather than just one like it would in C++ (which is obnoxious as hell to well versed C++ programmers). I still don't think that this would really make it much easier for people to learn. I TA the first C programming class the computer science majors have to take (the program is Java only prior) and pointers are a major point of contention. The D syntax I think makes it a bit clearer when to deference and when not to, which a lot of my students have issues with. However, I'm not sure it helps with dealing with the whole concept of what a pointer really is and how it works (nor would I really expect any school to teach D).

Vanadium
Jan 8, 2005

Did D actually go anywhere?

pr0metheus
Dec 5, 2010
What is a good build system for C/C++ projects? I have been using cmake and love it so far, but there is probably something better out there?

clockwork automaton
May 2, 2007

You've probably never heard of them.

Fun Shoe

Vanadium posted:

Did D actually go anywhere?

Um, yes? D2 is in active development and there are a decent amount of projects written in D. Which are mostly listed here.

github D projects: nice to see XOmB up there for being most watched. There was a D thread in COBOL a while back.

TasteMyHouse
Dec 21, 2006
What do you guys think of this? Is it just a massive troll? Reading it, I can tell where he's blatantly wrong sometimes, but I'm not savvy enough to have a rebuttal to everything he says on the tip of my tongue.

raminasi
Jan 25, 2005

a last drink with no ice

TasteMyHouse posted:

What do you guys think of this? Is it just a massive troll? Reading it, I can tell where he's blatantly wrong sometimes, but I'm not savvy enough to have a rebuttal to everything he says on the tip of my tongue.

What is he "blatantly wrong" about that he hasn't corrected?

And are you assuming that there's a rebuttal to everything he says?

e: other than the way he complete ignores generic programming as an idea

raminasi fucked around with this message at 23:12 on Apr 17, 2011

Elfforkusu
Jan 15, 2011

TasteMyHouse posted:

What do you guys think of this? Is it just a massive troll? Reading it, I can tell where he's blatantly wrong sometimes, but I'm not savvy enough to have a rebuttal to everything he says on the tip of my tongue.
The appropriate response to most of his complaints is "So? And?"

I read it as less of a troll and more of a whiny rant. No language is without its drawbacks, but most of the ones he mentions are generally irrelevant and can be easily circumvented by higher level programming practices.

TasteMyHouse
Dec 21, 2006

GrumpyDoctor posted:

What is he "blatantly wrong" about that he hasn't corrected?


he said you could get the address of a variable with a C++ reference, when thats really not how they work. He also trashed initializer lists, calling them "ugly" which I guess is his opinion, but I think its a wrong opinion =P.

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

Elfforkusu posted:

The appropriate response to most of his complaints is "So? And?"
And the rebuttal to his premise that C++ shouldn't be used for any new projects is to make a similar set of complaints about whatever language he suggests should be used instead. If there was a language that wasn't full of stupid flaws nearly everyone would be using it.

With most higher-level languages the flaw is "no access to system stuff" - hence Java GUIs frequently looking terribly out of place, for example, and generally relatively poor support for inherently low-level operations like talking to graphics cards. Either that or the "not even remotely portable" problem, as with C# or Objective C.

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.
YosefK is a whiny baby, but sometimes right. However, there are many sources that are also right that aren't nearly as whiny, annoying, and badly written as that website.

pr0metheus posted:

What is a good build system for C/C++ projects? I have been using cmake and love it so far, but there is probably something better out there?
After trying out several different cross-platform build systems, I've come to the conclusion that there aren't any better than make, despite make being insufficient in some ways for complex C or C++ projects. Here, my criteria for "good" are simple, fast, and able to track header file dependencies automatically.
  • (g)make - Very simple, as long as you use -rR. Doesn't know about header files. There's a tradeoff between speed and correctness. makedepend and similar ideas scan the whole project, which is slow, because preprocessing is slow and with them, you're doing it twice. This is mitigated since it only runs with a `make depend`, which means that if you add a header file to a .c file and forget to run `make depend`, something might break someday. The method outlined in "Recursive Make Considered Harmful" is the most correct, but suffers from the same doubled preprocessing problem as makedepend, every time you compile something.
  • mk - Simpler than make and I love it, but has the same issues with headers.
  • cmake - Complex if you ever want to use tools that cmake doesn't have targets for. The language spec seems to change frequently. Little-to-no help with cross-platforming flags (e.g. '-' vs. '/', cl flag names vs. gcc names, etc.).
  • scons - Complex if you ever want to use tools that scons doesn't expect on a platform (or more specifically, I couldn't get it to find flex and bison on Windows, no matter where I put the executables). Scales terribly. Little-to-no help with cross-platform flags.
  • fabricate - Almost perfect, too bad strace is Linux-only and Windows and OS X don't updates atimes these days. It works fine if you use something like their GccRunner example, but that reintroduces the preprocessing slowdown.
The real solution is to not have complex dependency graphs in C or C++ projects (or any project in general). If it's a pain to get tools to adequately deal with it, then most humans won't be able to comprehend it anyhow. I think Go (and by ancestry, Plan 9) has a good makefile setup for C and is worth mimicking. It's very easy to use and understand, and gives "good enough" dependency tracking. If you're interested, check out src/Make.ccmd and src/cmd/gc/Makefile to see how it works.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

TasteMyHouse posted:

What do you guys think of this? Is it just a massive troll? Reading it, I can tell where he's blatantly wrong sometimes, but I'm not savvy enough to have a rebuttal to everything he says on the tip of my tongue.
C++ does have a lot of dumb issues that you need to be aware of, and the FQA does a decent job of covering a lot of them. The problem is that for every useful point, there's also a page of whining about something that's not ideal but in practice not worth caring about and a page bitching about something in the C++ FAQ that isn't actually very related to the language.

Slurps Mad Rips
Jan 25, 2009

Bwaltow!

edit: (I ended up looking at the call stack, and none of what I said makes sense, so disregard this. I'll leave it here for posterity. Or something)

I have a brief question. Reading the documentation for Grand Central Dispatch implies that recursive calls to dispatch_sync result in a deadlock. Why then does this work? Wouldn't each subsequent dispatch_sync call wait for the next one to finish, but be in the "currently executing" position?

code:
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <dispatch/dispatch.h>

void merge (int *a, int *b, int n) {
    int i, *x, *p, *q;
    x = malloc(n * sizeof (int));
    for (i = 0, p = a, q = b; i < n; i++) 
        x[i] = p == b     ? *q++
             : q == a + n ? *p++
             : *p < *q    ? *p++
             :              *q++;
    memcpy(a, x, n * sizeof (int));
    free(x);
}   
 
void merge_sort (int *array, int size) {
  dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
    __block int *barray;
    __block int  mize;
    __block int* x = array;
    __block size_t s = size;
    if (size < 2)
        return;
    mize = size / 2;
    barray = array + mize;
    dispatch_sync(queue, ^{ merge_sort(x, mize); });
    dispatch_sync(queue, ^{ merge_sort(barray, s - mize); });
    dispatch_sync(queue, ^{ merge(x, barray, s); });
}
 
int main () {
    int a[] = { 38454, 39623, 29947, 82648, 77273, 1000, 69098, 97177, 43038, 
48953, 45947, 89301, 89736, 14941, 12279, 770, 6131, 59887, 31072, 3094, 87250,
5825, 60157, 10205, 13800, 91165, 19772, 5988, 38175, 12220, 98188, 16303, 86756, 
51959, 82797, 69907, 49190, 90491, 67198, 75181, 47536, 70602, 63988, 8498, 82438, 
34486, 72590, 3989, 8389, 44731, 72012, 89406, 74028, 20521, 1818, 17349, 41147, 
29965, 53048, 78803, 4, 65, 2, -31, 0, 99, 2, 83, 782, 1};
    int n = sizeof a / sizeof a[0];
    merge_sort(a, n);
  for (int idx = 0; idx < n; ++idx) {
    printf("%i ", a[idx]);
  }
  puts("");
    return 0;
}
output:
code:
-31 0 1 2 2 4 65 83 99 770 782 1000 1818 3094 3989 5825 5988 6131 8389 8498 10205 
12220 12279 13800 14941 16303 17349 19772 20521 29947 29965 31072 34486 38175 
38454 39623 41147 43038 44731 45947 47536 48953 49190 51959 53048 59887 60157 
63988 67198 69098 69907 70602 72012 72590 74028 75181 77273 78803 82438 82648 
82797 86756 87250 89301 89406 89736 90491 91165 97177 98188 
(please note I took this from the rosetta code wiki for merge sort, I only added the GCD calls. I am not responsible for that absolutely horrendous ternary clusterfuck within the merge function.)

Slurps Mad Rips fucked around with this message at 08:17 on Apr 18, 2011

Adbot
ADBOT LOVES YOU

Nalin
Sep 29, 2007

Hair Elf

pr0metheus posted:

What is a good build system for C/C++ projects? I have been using cmake and love it so far, but there is probably something better out there?
I personally use premake. You specify your project details using Lua and premake uses that to generate a project file for you. It is pretty easy to use, but it is somewhat simple, so if you need something more advanced, it may be best to look at Mustach's list.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply