| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Memory Blocks snuffed ? |
G'Day David,
-=> Quoting David Nugent to Frank Adam <=-
> You mean a mix of C and classes ? I do that sometimes.
DN> No, I mean using OOP methodology.
Ah, yes i actually tried hard to get rid of that habit, since i've
been writing pure(ish) C. Never the less i do like the idea of eg.
shock-horror, for (int i=0;...)
I'm not sure where else C++ would differ from C as far as auto vars are
concerned, but it's probably not important.
> DN> My experience is that the need to reallocate almost always stems from
> DN> one of two scenarios. The first is an array, as I've just
> DN> mentioned. The second is a buffer that contains text, which
> DN> you are adding, removing or searching (such as you'd find
DN> For example, you would normally fetch lines or paragraphs from it
DN> rather than printing it in one hit. And you would more likely to
DN> insert things into it and minipulate parts of it than you would
DN> with a string. The algorithm I use is an adaptation of the
DN> "gap" technique (popular with editors), which is based on
DN> the idea that the "hole" of free space inside a buffer can
DN> slide within it - to insert text less than the size of the
DN> gap, you just move the cursor (lower bounds of the gap) to
Would you know of a site or name of an editor (with source) that would
have that ?
I'd like to have a look at this, at first read it seemed simple, but the
more i think about it the more complicated it gets.
I'm not sure if i get this slididng business.It sounds like just a few ifs
and memmoves,perhaps the buffer would need to be padded with spaces too.
Although i have a feeling that my editgets.cpp function would be doing
something similar, in insert mode(it works on a malloced length char*).
L8r Frank (fadam{at}ozemail.com.au).
___ Blue Wave/DOS v2.21
--- Maximus 3.01
* Origin: The Software Parlour (3:635/544)SEEN-BY: 50/99 620/243 623/630 632/349 635/503 544 727 711/401 409 410 413 SEEN-BY: 711/430 808 809 932 934 712/515 713/888 714/906 800/1 @PATH: 635/544 50/99 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.