On 08/06/2013 02:49, Marc Weber wrote:
Well - I don't want to discuss the topic.
I just want to know how to do basic stuff "the Vim way" efficiently.
C++ is not perfect, and probably its easiy to get things wrong.
But at least it provides standard ways for standard tasks, such as
arrays/vectors/maps/hashes whatsoever.
Eg buffer.c contains:
/*
* put new buffer at the end of the buffer list
*/
buf->b_next = NULL;
if (firstbuf == NULL) /* buffer list is empty */
{
buf->b_prev = NULL;
firstbuf = buf;
}
else /* append new buffer at end of list */
{
lastbuf->b_next = buf;
buf->b_prev = lastbuf;
}
lastbuf = buf;
which is not bad. But if you need the same feature again: a linked list
like whatsoveer structure, it looks like the standard way is to write
the same code again. Its taking programmers time and is more likely to
be wrong.
I personally don't want to spend time on thinking about how to use
malloc, realoc or such for simple things like lists, maps, ...
Thus is there a standard way, a preprocessor like library which gets the
job done?
See BSD list and tree macros as described and linked from here:
http://ivoras.sharanet.org/freebsd/usetree.html
> something like:
define_list(vim_buffer);
providing functions like
vim_buffer_list_new()
vim_buffer_list_add(...)
vim_buffer_list_remove(...)
?
Does it make sense to port Vim to C++, just to use some very basic C++
like features, such as vector, map and so on?
If not - can we document why?
Since the code base still assumes prototypes are not supported, nor some
long standing basic types like ptrdiff_t, working out the common minimal
C++ language support at this stage would be a bit of a nightmare.
Perhaps instead of everyone doing mad dashes to new features we could
start on starting to refactor the code base for such things with all the
benefits it could bring.
2ps worth.
I know that Vim has a long history, but the future of Vim is likely to
be longer than its history.
Does Vim run on any platforms only supporting C, not C++?
Sorry for having to ask such a stupid question. Its about simple
features like "make vim populate quickfix in realtime, so that the 4sec
issue I talked about goes away".
I expect that Vim's future will be longer than its (long) history was.
So its worth using simple improvements, too.
If you think this question is nonsense, make me understand why.
So which is the reason sticking to C only, and which is the reason not
introducing a template library for simple things like lists?
If moving to C++ is not an option, but moving ot a tmeplate library is,
is there one you would recommend?
I want to have a native implementation for vim-addon-async for example.
Marc Weber
Mike
--
This is certainly more fun than being hit with a hammer.
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.