Saturday, June 13, 2020

Digest for comp.lang.c++@googlegroups.com - 4 updates in 1 topic

Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jun 13 07:39PM +0100

>>> code.
 
>> C++ isn't a language for easy solutions.
 
> True that! :-)
 
Oh look. Two trolls getting it on.
 
/Flibble
 
--
"Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin
 
"You won't burn in hell. But be nice anyway." – Ricky Gervais
 
"I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais
 
"Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say."
Bart <bc@freeuk.com>: Jun 13 10:03PM +0100

> way to disk, restore it, or transmit it from A to B over a net-
> work, and it would be automatically parsed upon receipt. No extra
> processing.
 
None of these requires creating a new, highly specific language feature
implementation of which has considerable ramifications.
 
What's the problem with using this:
 
typedef struct {
int a; char* s;
int b; char* t;
int c; char* u;
} S3;
 
S3 x; // Now we CAN create it like this
 
x.a = A;
x.s = heapstr(S); // create copy of S on heap
// or just use x.s = S if appropriate
 
x.b = B;
x.t = heapstr(T);
 
x.c = C;
x.d = heapstr(U);
 
Advantages:
 
(1) This works NOW with no new features or new compiler with special
extensions for member access, sizeof() etc.
 
(2) The 3 strings inside x can be set up in any order
 
(3) They can be modified at any time, including making any string longer
or shorter.
 
(4) It's easy to create arrays of S3
 
(5) It's easy to embed S3 inside another struct, without making all
following members have dynamic offsets, or making the size of that
enclosing struct dynamic
 
(6) If set up using 'x.s = S' etc, this can point into the original
loaded file data, allowing certain in-place modifications
 
(7) S, T, U can all be slices of the same string data
 
(8) For very large strings, having them occupy separate heap areas puts
less pressure on memory compared with one allocation for all 3 strings
 
Although, I can't see what you can't just use a C++ 'string' type here.
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jun 13 10:51PM +0100

On 13/06/2020 22:03, Bart wrote:
 
> (7) S, T, U can all be slices of the same string data
 
> (8) For very large strings, having them occupy separate heap areas puts less pressure on memory compared with one allocation for all 3 strings
 
> Although, I can't see what you can't just use a C++ 'string' type here.
 
He is doing it because he believes it pleases his god. Such a waste of energy but delusions are such.
 
/Flibble
 
--
"Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin
 
"You won't burn in hell. But be nice anyway." – Ricky Gervais
 
"I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais
 
"Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say."
rick.c.hodgin@gmail.com: Jun 13 03:09PM -0700

On Saturday, June 13, 2020 at 5:03:27 PM UTC-4, Bart wrote:
> int b; char* t;
> int c; char* u;
> } S3;
 
Runtime parsing. Having the variable struct removes the need for
parsing. The data packet is ready to go as-is.
 
--
Rick C. Hodgin
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: