[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Feature request: plain option for gsub
- From: Coroutines <coroutines@...>
- Date: Mon, 25 Aug 2014 03:27:59 -0700
On Sun, Aug 24, 2014 at 7:40 PM, Sean Conner <sean@conman.org> wrote:
> Because elsewhere you said:
>
>> I would like the option of peering into and modifying any userdata
>> from Lua as if it were a string, with the string functions. This
>> would break security so I'd want to control this ability through the
>> debug library.
>
> That's why. So, yeah, LPeg example.
I was joking that for a userdata example you brought in LPeg -- which
not many people understand (myself included at times).
> In C, a structure is just a sequence of bytes. In C, a string is just a
> sequence of bytes. Yes, in C, you can cast a structure pointer to a
> character pointer and back again. It doesn't mean that's a good idea.
This is actually how I was representing my socket type in C -- it was
basically { lua_Stream, fd, SOCKET (HANDLE on Windows) }.
Wherever I needed a lua_Stream because it was the first element I
could cast the pointer to that type -- it was quite handy ;p
These replies feel like "I can't trust you to know what you're doing
so let's argue about it until you lose credibility and interest"...
> But then don't be surprised when you ask us to help you fail and we
> refuse. Some of us here have already been down that road and are trying to
> warn you about the dangers ahead.
I didn't know I was specifically asking you for help -- I was only
trying to put forth the idea that mutable, unpooled strings/buffers
have their place. Anyway, far off the topic of this thread...
> struct somestruct
> {
> int x;
> int y;
> char *name;
> };
>
> You want to pass that as a message. It contains a pointer to some string.
> A zero-copy message passing scheme doesn't mean the memory pointed to by
> name is included. You still have to flatten the thing into a single block
> of memory.
I have been writing C since 2005, I understand references -- this is
starting to feel like I'm being talked down to...
I told you before I was only trying to use userdata for a buffer to
recv() into. I understand the perils of looking at structs
represented through userdata (from padding & alignment to references).
> And even a function call copies data ...
Wait... so you're saying the stack and registers are used for something? :p
- References:
- Re: Feature request: plain option for gsub, Axel Kittenberger
- Re: Feature request: plain option for gsub, Coroutines
- Re: Feature request: plain option for gsub, Sean Conner
- Re: Feature request: plain option for gsub, Coroutines
- Re: Feature request: plain option for gsub, Sean Conner
- Re: Feature request: plain option for gsub, Coroutines
- Re: Feature request: plain option for gsub, Sean Conner
- Re: Feature request: plain option for gsub, Coroutines
- Re: Feature request: plain option for gsub, Sean Conner
- Re: Feature request: plain option for gsub, Coroutines
- Re: Feature request: plain option for gsub, Sean Conner