User: Password:
Subscribe / Log in / New account

Generic red-black trees

Generic red-black trees

Posted Jun 14, 2012 14:08 UTC (Thu) by Cyberax (✭ supporter ✭, #52523)
In reply to: Generic red-black trees by nix
Parent article: Generic red-black trees

People use dynamic bytecode generation and/or reflection in Java quite often as a replacement for things done with templates/preprocessor.

(Log in to post comments)

Generic red-black trees

Posted Jun 14, 2012 16:07 UTC (Thu) by etienne (guest, #25256) [Link]

Maybe the nice thing about templates/preprocessor is that the work is done once at compilation time, and not each times the software is started.
Also, preprocessor help you to initialise a lot of things which will then be loaded in memory already initialised, ready to use.
It is not unheard-of to generate a lot of variable/structure and sort them by the "sort" command in Makefile to have a sorted list ready to use, with pointer to next already set by the linker. That initialised memory will also have good cache locality.
Some people may also have tried to use the old "m4" macro language to replace the CPP processor, but it did not stick too nicely.

Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds