If you have time and you know C/C++ (Builder) and/or Delphi please help build this knowledge base:

http://www.brainybinary.com/cppbdelphi

You can post without needing to log-in. HTML is enabled.
Posted on 2009-05-19 06:41:25 by XCHG
a "foreach" macro, and stuff is temporary here:

www.ultranos.com/temp/ultrano.cpp
www.ultranos.com/temp/ultrano.h

VC++2k5
Posted on 2009-05-19 07:48:00 by Ultrano
Would it be okay to link to that source code there? Do you think you are going to be able to host it for a long time?
Posted on 2009-05-19 08:21:06 by XCHG
If you want to take a look at my own codebase (C++), it can be found at http://roticv.rantx.com/lib.txt I use it personally for training for ACM-ICPC and of course ACM-ICPC contests.

I will update it from time to time as I learn new stuff. There's a todo list, but I haven't gotten myself to work on the stuff on the todo list.
Posted on 2009-05-19 09:56:30 by roticv
I can't host those files permanently.
Posted on 2009-05-19 13:33:49 by Ultrano

If you want to take a look at my own codebase (C++), it can be found at http://roticv.rantx.com/lib.txt I use it personally for training for ACM-ICPC and of course ACM-ICPC contests.

I will update it from time to time as I learn new stuff. There's a todo list, but I haven't gotten myself to work on the stuff on the todo list.


Wow that's a big file. What can I do with that? lol
Posted on 2009-05-19 16:00:54 by XCHG

a "foreach" macro, and stuff is temporary here:

www.ultranos.com/temp/ultrano.cpp
www.ultranos.com/temp/ultrano.h

VC++2k5


I took the time to read ultrano.cpp. It's very nice. I saw that you don't include <stdio.h> and you just declare the extern "C" prototypes of the C library before you need them. Is this for compile speed ?  :)

You wrote your own garbage collector, your own string functions and your own memory allocator. It's very nice of you to share this!


Posted on 2009-05-19 18:43:23 by ChaperonNoir


Wow that's a big file. What can I do with that? lol


You can kill the world with it.  ;) Basically it contains various algorithms such as maximum flow, kruskal and data structures such as suffix array, fenwick trees, trie and so on.
Posted on 2009-05-19 19:39:40 by roticv

I saw that you don't include <stdio.h> and you just declare the extern "C" prototypes of the C library before you need them. Is this for compile speed ?  :)
You wrote your own garbage collector, your own string functions and your own memory allocator. It's very nice of you to share this!

I just didn't want to include whole files for one func.
The garbage "collector" is just a simple "heap", a list of objects that I allocate in some RAM-wasteful proc. On proc-exit, the garbage collection object is destroyed, and with it it frees all garbage.
The xmalloc/xfree stuff is mostly for convenience and sanity of standards: zero-allocated memory by default; resizing memory will allocate or free if old_ptr/new_size are null. Memory-append and get-memory-size, which are must-haves but miss from CRT standards (for fear of misbehavior on lack of RAM).
Debug-macros that use VKDebug.
Easier file access and VFile to write to a RAM file.
CRTInitializer trick to dynamically register callbacks/stuff on startup into an array (you only make the array public, the different objects reside hidden in different .cpp files)
ObjVector and its "foreach" macro  for uber-convenience.
Overloads of new/new[] and delete/delete[], to zero-initialize, inspect and unify memory.
Hashtab and Uniquearray for collections.

It's a bunch of simple procs and wrappers with the sole purpose to make kick-starts as convenient and unified as possible. It's a partial port of my MASM runtime stuff.
Posted on 2009-05-20 01:30:12 by Ultrano
Yes indeed, I saw that your memory allocator was nicer to use than malloc because it actually always returns zeroed memory. With malloc memory you don't always get zeroed memory! Actually, even with my 4gig of ram here, I get recycled memory a lot more than a zeroed page.

Why is VKDebug nice? Don't you use an IDE with a debugger? What's the difference between VKDebug and a log file.

Posted on 2009-05-20 09:04:46 by ChaperonNoir

Yes indeed, I saw that your memory allocator was nicer to use than malloc because it actually always returns zeroed memory. With malloc memory you don't always get zeroed memory! Actually, even with my 4gig of ram here, I get recycled memory a lot more than a zeroed page.

calloc() ?

Ultrano and roticv, you have some really nice code there  :thumbsup:
Posted on 2009-05-20 09:57:41 by drizz

Why is VKDebug nice? Don't you use an IDE with a debugger? What's the difference between VKDebug and a log file.

I can just give the two executables to a beta-tester and receive the relevant parts of the debug log; Alt+tab or stay-on-top are a lot easier to manage than playing around with IDE-integrated windows; keeping logs between different runs is possible; the text is not read-only.
Anyway, at any time I can just route the logging to a file, IDE or null; I simply haven't needed that yet.
Posted on 2009-05-20 10:17:41 by Ultrano


Why is VKDebug nice? Don't you use an IDE with a debugger? What's the difference between VKDebug and a log file.

I can just give the two executables to a beta-tester and receive the relevant parts of the debug log; Alt+tab or stay-on-top are a lot easier to manage than playing around with IDE-integrated windows; keeping logs between different runs is possible; the text is not read-only.
Anyway, at any time I can just route the logging to a file, IDE or null; I simply haven't needed that yet.


I agree that this type of debugging is so much easier. When I code with the iPhone SDK and XCode under Mac, there is an Output window which you can activate with CMD+Shift+R and in your GUI programs whenever you do printf() it will print it to that window so it's great for debugging and so much better than showing messages with MessageBox() under Windows for example.

Yeah both codes are great. I am going to have to go through them and extract parts of them and put them there on the knowledge base if you guys agree.
Posted on 2009-05-21 03:49:29 by XCHG
Go ahead. I'm not stopping you.  ;)
Posted on 2009-05-21 04:16:27 by roticv