Re: A portable stack in C

Discussion in 'C Programming' started by blmblm@myrealbox.com, Nov 17, 2011.

  1. Guest

    In article <4ec14700$0$1387$>,
    io_x <> wrote:
    >
    > in the while the train go always more far from home


    io_x's English is a lot better than my Italian, but still ....

    I have *no* idea what he(?) is getting at here and would be glad
    of a translation/explanation. Anyone?

    > i think to these questions:
    > is it possible to build a portable stack in C using uns32_t?
    > is it possible to define in C a pointer of size 32 bits portable
    > as uns32_t? could it be "uns32_t"?
    > is it possible using that stack for call of function as
    > f(a, b) <=> push32 b|push32 a| call32 f
    > i remember someone says that for calling function
    > it has to be a stack: i'm agree with him
    > thank you


    --
    B. L. Massingill
    ObDisclaimer: I don't speak for my employers; they return the favor.
     
    , Nov 17, 2011
    #1
    1. Advertising

  2. John Gordon Guest

    In <> <> writes:

    > In article <4ec14700$0$1387$>,
    > io_x <> wrote:
    > >
    > > in the while the train go always more far from home


    > io_x's English is a lot better than my Italian, but still ....


    > I have *no* idea what he(?) is getting at here and would be glad
    > of a translation/explanation. Anyone?


    He wrote this while riding on a train?

    --
    John Gordon A is for Amy, who fell down the stairs
    B is for Basil, assaulted by bears
    -- Edward Gorey, "The Gashlycrumb Tinies"
     
    John Gordon, Nov 17, 2011
    #2
    1. Advertising

  3. BartC Guest

    "io_x" <> wrote in message
    news:4ec53d42$0$1387$...
    >
    > "" <> ha scritto nel
    > messaggio
    > news:...
    >> In article <4ec14700$0$1387$>,
    >> io_x <> wrote:
    >>>
    >>> in the while the train go always more far from home

    > ^^^^^
    > goes
    >
    > nel mentre il treno andava sempre più lontano da casa


    I still don't get this, English *or* Italian.

    > lets call one programming language X
    > i thought only if instead of doing the traslation X -> x86 cpu
    > is it possible doing X -> C -> all cpu
    > without U.B.


    That can work for some kinds of languages. For others, C simply can't
    express what you want to do, then you try emulating the desired behaviour,
    and end up writing an interpreter instead of a compiler.

    There was a language called C-- designed for just that purpose of a target
    language, but not sure how active that is or how well it worked (or how
    widespread were compilers for it; see www.cminusminus.org).

    C itself presents a few obstacles to someone trying to use it as a target
    language.

    Still, 'X -> C -> all cpu' is just about workable, but for preference you'd
    have 'X -> specific cpu'. Unless you're just interesting in an interpreter
    for X then C is probably as good for it as any other language, if you're not
    interested in performance.

    --
    Bartc
     
    BartC, Nov 17, 2011
    #3
  4. On Nov 17, 5:35 pm, "BartC" <> wrote:
    > "io_x" <> wrote in message
    > news:4ec53d42$0$1387$...
    > > "" <> ha scritto nel
    > > messaggio
    > >news:...
    > >> In article <4ec14700$0$1387$>,
    > >> io_x <> wrote:


    > >>> in the while the train go always more far from home

    > >                         ^^^^^
    > >                          goes

    >
    > > nel mentre il treno andava sempre più lontano da casa

    >
    > I still don't get this, English *or* Italian.


    I put the Italian through Google Translate

    "while in the train went farther and farther from home"

    and still no joy. So io_x are you *actually* on a train or is it some
    sort of metaphor? C being "home" and the train representing the
    "journey" away from it?

    Ritchie the Fat Controller and bit fields the grumpy carriages...

    > > lets call one programming language X
    > > i thought only if instead of doing the traslation X -> x86 cpu
    > > is it possible doing X -> C -> all cpu
    > > without U.B.


    C as universal assembler. This is actually how a lot of langaues are
    implemented (at least initially). C++ was a compiler that compiled
    into C. the advantage of this approach is you high portability but a
    slow compiler.

    I've also heard it said C isn't a particularly good "universal
    assmbler". Though I'm not entirely sure why. I think it isn't low
    level enough to do some of the things needed. (I tried writing a
    scheme (ie.lisp) interpreter in C and it was horrid C)

    > That can work for some kinds of languages. For others, C simply can't
    > express what you want to do, then you try emulating the desired behaviour,
    > and end up writing an interpreter instead of a compiler.
    >
    > There was a language called C-- designed for just that purpose of a target
    > language, but not sure how active that is or how well it worked (or how
    > widespread were compilers for it; seewww.cminusminus.org).
    >
    > C itself presents a few obstacles to someone trying to use it as a target
    > language.
    >
    > Still, 'X -> C -> all cpu' is just about workable, but for preference you'd
    > have 'X -> specific cpu'. Unless you're just interesting in an interpreter
    > for X then C is probably as good for it as any other language, if you're not
    > interested in performance.
     
    Nick Keighley, Nov 18, 2011
    #4
  5. BartC Guest

    "Nick Keighley" <> wrote in message
    news:...

    > I've also heard it said C isn't a particularly good "universal
    > assmbler". Though I'm not entirely sure why. I think it isn't low
    > level enough to do some of the things needed.


    Because it isn't an assembler. There are some quite straightforward
    requirements, such as defining an integer of exactly 32-bits, that were
    quite difficult to do (at least until C99).

    > (I tried writing a
    > scheme (ie.lisp) interpreter in C and it was horrid C)


    Last time I tried to use C as a target, the existing features of C couldn't
    express some of the things I wanted to do, so I used workarounds. Then I
    found I might as well use these ugly workarounds for everything (since
    no-one would be reading the code). Which meant I didn't really need most of
    C's features: control statements, loops, variables(!), structs, typedefs.

    All that was left were char-arrays, functions, goto, and expressions. And
    the latter didn't work on any of my types that didn't exactly correspond to
    a C type, so functions were needed instead of in-fix operators.

    At this point I gave up. The amount of effort to fit a round language into
    the square hole of C, and generating syntax which is just right, and then
    invoking some C compiler which reports errors on line numbers which have
    little to do with your original code, meant it wasn't worth the trouble.

    (This wouldn't matter so much if C was really that portable. But from
    my experience it seems to be a bit of a myth. Try taking any open-source C
    project, and try building it on some esoteric platform such as MS Windows,
    and see how far you get!

    It also wouldn't matter if you could benefit from super-optimising C
    ompilers. But with much of the program structure non-existent, and faced
    with some weird-looking code, they would have a hard job.)

    --
    Bartc
     
    BartC, Nov 18, 2011
    #5
  6. Guest

    In article <4ec53d42$0$1387$>,
    io_x <> wrote:
    >
    > "" <> ha scritto nel messaggio
    > news:...
    > > In article <4ec14700$0$1387$>,
    > > io_x <> wrote:
    > >>
    > >> in the while the train go always more far from home

    > ^^^^^
    > goes
    >
    > nel mentre il treno andava sempre più lontano da casa


    How is this any help to someone who doesn't speak Italian?
    I thought it might be an adage or idiom of some sort, but
    a Google search for the above turns up only your post.

    > > io_x's English is a lot better than my Italian, but still ....

    >
    > yes my i/o is not always easy to understand, but i'm lazy
    > and prefer to write in that way: full of errors


    This *sounds* like for some reason you *want* to write badly (with
    the accompanying risk of being misunderstood), and I can't quite
    imagine why anyone would want that. But perhaps you mean only
    that you don't care enough to take the time to try to improve your
    English, which is -- your choice, I guess, a matter of priorities.

    > > I have *no* idea what he(?) is getting at here and would be glad
    > > of a translation/explanation. Anyone?

    >
    > lets call one programming language X

    [ snip ]

    No, no, I wasn't asking for an explanation of the technical part of
    your post -- I want someone to explain the remark about the train!
    That's the part that puzzles me. I guess that wasn't clear,
    but I'm not sure what I could have to done to make it clearer.

    > is it possible doing X -> C -> all cpu
    > without U.B.
    > and search min C language subset enought for doing that.
    > what is in seems to be: 32 bit registers[uin32_t], jumps je, jz[goto]
    > portable operation on registers [i hope: and, xor, or, not, neg, etc
    > on uint32_t variables]
    > what is out is: the stack, push32, pop32, esp,
    >
    > >> i think to these questions:
    > >> is it possible to build a portable stack in C using uns32_t?
    > >> is it possible to define in C a pointer of size 32 bits portable
    > >> as uns32_t? could it be "uns32_t"?
    > >> is it possible using that stack for call of function as
    > >> f(a, b) <=> push32 b|push32 a| call32 f
    > >> i remember someone says that for calling function
    > >> it has to be a stack: i'm agree with him
    > >> thank you


    --
    B. L. Massingill
    ObDisclaimer: I don't speak for my employers; they return the favor.
     
    , Nov 18, 2011
    #6
  7. James Kuyper Guest

    On 11/18/2011 09:45 AM, wrote:
    > In article <4ec53d42$0$1387$>,
    > io_x <> wrote:

    ....
    >> yes my i/o is not always easy to understand, but i'm lazy
    >> and prefer to write in that way: full of errors

    >
    > This *sounds* like for some reason you *want* to write badly (with
    > the accompanying risk of being misunderstood), and I can't quite
    > imagine why anyone would want that.


    As far as I can tell, he does want to be misunderstood. He's certainly
    succeeding at it, so if it isn't explicitly his goal in life, he's got a
    problem.
     
    James Kuyper, Nov 18, 2011
    #7
  8. <> writes:
    [...]
    > No, no, I wasn't asking for an explanation of the technical part of
    > your post -- I want someone to explain the remark about the train!
    > That's the part that puzzles me. I guess that wasn't clear,
    > but I'm not sure what I could have to done to make it clearer.

    [...]

    Ok.

    But suppose you find out what the train remark meant. What illumination
    do you expect that to provide?

    Is asking what io_x meant by one more of his random remarks really a
    good use of time and bandwidth?

    My advice: Don't feed the troll.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Nov 18, 2011
    #8
  9. Jo Guest

    Nick Keighley wrote:
    > On Nov 17, 5:35 pm, "BartC" <> wrote:
    >> "io_x" <> wrote in message
    >> news:4ec53d42$0$1387$...
    >>> "" <> ha scritto nel
    >>> messaggio
    >>> news:...
    >>>> In article <4ec14700$0$1387$>,
    >>>> io_x <> wrote:

    >
    >>>>> in the while the train go always more far from home
    >>> ^^^^^
    >>> goes

    >>
    >>> nel mentre il treno andava sempre più lontano da casa

    >>
    >> I still don't get this, English *or* Italian.

    >
    > I put the Italian through Google Translate
    >
    > "while in the train went farther and farther from home"
    >
    > and still no joy. So io_x are you *actually* on a train or is it some
    > sort of metaphor? C being "home" and the train representing the
    > "journey" away from it?
    >
    > Ritchie the Fat Controller and bit fields the grumpy carriages...


    That is so cliche, especially at this time of year. You should have
    quoted the following universally familiar passage (if not a bit too
    pedantic for a group of this caliber):

    "Glasses of pebbles in an odyssey already spoken, on hidden stairs from
    the box of ended mirrors, then and where it only was yesterday prevailant
    seldomly up until a previously unknown familiar time before, she began,
    but not with the chimes, which withstood then, disheartening her and
    causing her to sing in fine attire blightly engaged but not moreso than
    the fisherman."
     
    Jo, Nov 19, 2011
    #9
  10. Guest

    In article <>,
    Keith Thompson <> wrote:
    > <> writes:
    > [...]
    > > No, no, I wasn't asking for an explanation of the technical part of
    > > your post -- I want someone to explain the remark about the train!
    > > That's the part that puzzles me. I guess that wasn't clear,
    > > but I'm not sure what I could have to done to make it clearer.

    > [...]
    >
    > Ok.
    >
    > But suppose you find out what the train remark meant. What illumination
    > do you expect that to provide?


    I don't know -- and that's kind of the point. I suppose it's even
    *possible* that it could be some brilliant metaphor that sheds light
    on the more-on-topic part of io_x's post. (Granted that that seems
    unlikely, still, we won't know .... )

    > Is asking what io_x meant by one more of his random remarks really a
    > good use of time and bandwidth?


    Eh, maybe not, since it's not just my time we're talking about, is it?

    > My advice: Don't feed the troll.


    I'd say not so much troll as, um, "person with unusual opinions, fond
    of airing them" (to be diplomatic), but -- whatever.

    --
    B. L. Massingill
    ObDisclaimer: I don't speak for my employers; they return the favor.
     
    , Nov 19, 2011
    #10
  11. Seebs Guest

    On 2011-11-19, blmblm myrealbox.com <> wrote:
    > I'd say not so much troll as, um, "person with unusual opinions, fond
    > of airing them" (to be diplomatic), but -- whatever.


    He's either intentionally trolling or seriously illucid. He seems to be
    deeply convinced that it's vital to use single-character names for efficiency
    whenever possible, for instance.

    He's been writing stupendously bad code in C for as long as anyone can
    remember, and he seems to be functionally ineducable. He might be a troll,
    he might not be, but in any event it doesn't seem possible to communicate
    productively with him at this time.

    -s
    --
    Copyright 2011, all wrongs reversed. Peter Seebach /
    http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
    http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
    I am not speaking for my employer, although they do rent some of my opinions.
     
    Seebs, Nov 19, 2011
    #11
  12. Jo Guest

    Seebs wrote:

    > He's been writing stupendously bad code in C for as long as anyone can
    > remember, and he seems to be functionally ineducable.


    That's a fricken oxymoron: I've yet to see a C programmer write any good
    code! How can you have any pudding if you don't eat your meat?!
     
    Jo, Nov 20, 2011
    #12
  13. Jo Guest

    Keith Thompson wrote:

    Aside. This is your (decidedly old world banner): Keith Thompson
    (The_Other_Keith)

    Who the **** is that? Read, you post shit like that, it better be
    underlined. (For you, that means "hyperlink", look it up).

    I have better things to do than you making mad as hell. Bitch.
     
    Jo, Nov 21, 2011
    #13
  14. On Nov 18, 9:40 am, "io_x" <> wrote:
    > "Nick Keighley" <> ha scritto nel messaggionews:...
    > On Nov 17, 5:35 pm, "BartC" <> wrote:
    > > "io_x" <> wrote in message
    > >news:4ec53d42$0$1387$...
    > > > "" <> ha scritto nel
    > > > messaggio
    > > >news:...
    > > >> In article <4ec14700$0$1387$>,
    > > >> io_x <> wrote:


    > > >>> in the while the train go always more far from home


    <snip train gibberish>

    > [...] So io_x are you *actually* on a train or is it some
    > sort of metaphor?

    [...]
    > #it is not one metatphor


    so explain what you mean or shut up about the train


    > Ritchie the Fat Controller and bit fields the grumpy carriages...
    >
    > > > lets call one programming language X
    > > > i thought only if instead of doing the traslation X -> x86 cpu
    > > > is it possible doing X -> C -> all cpu
    > > > without U.B.

    >
    > C as universal assembler. This is actually how a lot of langauges are
    > implemented (at least initially). C++ was a compiler that compiled
    > into C. the advantage of this approach is you [get] high portability but a
    > slow compiler.
    >
    > #it depend what is the set of instructions you send to compiler
    > #if they are complex or easy


    no.

    > I've also heard it said C isn't a particularly good "universal
    > assmbler". Though I'm not entirely sure why. I think it isn't low
    > level enough to do some of the things needed. (I tried writing a
    > scheme (ie.lisp) interpreter in C and it was horrid C)
    >
    > #i don't know; i like on 32 bits unsigned, most importat u32[operators]=u32,
    > #call32[stack],


    is that C

    > #variables definition[in the stack], jumps32, clc, stc, push32, pop32,
    > ret_XXbits
    > # esp for reserve memory in the stack and use it
    > #i think with that all could be easy
    > #where 32 means 32 bit


    that definitely isn't C. Did you read what I wrote?
     
    Nick Keighley, Nov 21, 2011
    #14
  15. Jo Guest

    Nick Keighley wrote:
    > On Nov 18, 9:40 am, "io_x" <> wrote:
    >> "Nick Keighley" <> ha scritto nel
    >> messaggionews:...
    >> On Nov 17, 5:35 pm, "BartC" <> wrote:
    >>> "io_x" <> wrote in message
    >>> news:4ec53d42$0$1387$...
    >>>> "" <> ha scritto nel
    >>>> messaggio
    >>>> news:...
    >>>>> In article <4ec14700$0$1387$>,
    >>>>> io_x <> wrote:

    >
    >>>>>> in the while the train go always more far from home

    >
    > <snip train gibberish>
    >
    >> [...] So io_x are you *actually* on a train or is it some
    >> sort of metaphor?

    > [...]
    >> #it is not one metatphor

    >
    > so explain what you mean or shut up about the train. You just want me
    > to cry. Are you you fuckin stupid?


    You like to argue with me. You are fucking with me. You don't hear the
    train? Really? Don't **** with me.


    Your are certainly a fucking idiot. Step up, the only one that can trump
    that, is me. And that is a lie. Just leave me alone. I am not you.
     
    Jo, Nov 21, 2011
    #15
  16. Jo Guest

    Nick Keighley wrote:
    "Who will stop the rain"?
     
    Jo, Nov 21, 2011
    #16
  17. Phil Carmody Guest

    "Jo" <> writes:
    > Nick Keighley wrote:
    > > On Nov 18, 9:40 am, "io_x" <> wrote:
    > >> "Nick Keighley" <> ha scritto nel
    > >> messaggionews:...
    > >> On Nov 17, 5:35 pm, "BartC" <> wrote:
    > >>> "io_x" <> wrote in message
    > >>> news:4ec53d42$0$1387$...
    > >>>> "" <> ha scritto nel
    > >>>> messaggio
    > >>>> news:...
    > >>>>> In article <4ec14700$0$1387$>,
    > >>>>> io_x <> wrote:

    > >
    > >>>>>> in the while the train go always more far from home

    > >
    > > <snip train gibberish>
    > >
    > >> [...] So io_x are you *actually* on a train or is it some
    > >> sort of metaphor?

    > > [...]
    > >> #it is not one metatphor

    > >
    > > so explain what you mean or shut up about the train. You just want me
    > > to cry. Are you you fuckin stupid?


    The post I received at my server ended at "train".

    Do not misquote people.

    > You like to argue with me. You are fucking with me. You don't hear the
    > train? Really? Don't **** with me.
    >
    >
    > Your are certainly a fucking idiot. Step up, the only one that can trump
    > that, is me. And that is a lie. Just leave me alone. I am not you.


    Then again, if you do misquote people, I won't notice it any more.
    You've proved yourself entirely not worth reading.

    Phil
    --
    Unix is simple. It just takes a genius to understand its simplicity
    -- Dennis Ritchie (1941-2011), Unix Co-Creator
     
    Phil Carmody, Nov 21, 2011
    #17
  18. Jo Guest

    Phil Carmody wrote:
    > "Jo" <> writes:
    >> Nick Keighley wrote:
    >>> On Nov 18, 9:40 am, "io_x" <> wrote:
    >>>> "Nick Keighley" <> ha scritto nel
    >>>> messaggionews:...
    >>>> On Nov 17, 5:35 pm, "BartC" <> wrote:
    >>>>> "io_x" <> wrote in message
    >>>>> news:4ec53d42$0$1387$...
    >>>>>> "" <> ha scritto
    >>>>>> nel messaggio
    >>>>>> news:...
    >>>>>>> In article <4ec14700$0$1387$>,
    >>>>>>> io_x <> wrote:
    >>>
    >>>>>>>> in the while the train go always more far from home
    >>>
    >>> <snip train gibberish>
    >>>
    >>>> [...] So io_x are you *actually* on a train or is it some
    >>>> sort of metaphor?
    >>> [...]
    >>>> #it is not one metatphor
    >>>
    >>> so explain what you mean or shut up about the train. You just want
    >>> me to cry. Are you you fuckin stupid?

    >
    > The post I received at my server ended at "train".
    >
    > Do not misquote people.


    I don't quote anyone. Who do think is so important and that I blasphemed?

    >
    >> You like to argue with me. You are fucking with me. You don't hear
    >> the train? Really? Don't **** with me.
    >>
    >>
    >> Your are certainly a fucking idiot. Step up, the only one that can
    >> trump that, is me. And that is a lie. Just leave me alone. I am not
    >> you.

    >
    > Then again, if you do misquote people, I won't notice it any more.
    > You've proved yourself entirely not worth reading.
    >


    Amd this fixiation of yours of the train, I am supposed to take that how?
    Why dont you ask your dad about that instead of wasting my time.
     
    Jo, Nov 21, 2011
    #18
  19. On Nov 21, 7:24 am, "Jo" <> wrote:
    > Keith Thompson wrote:
    >
    > Aside. This is your (decidedly old world banner): Keith Thompson
    > (The_Other_Keith)
    >
    > Who the <expletive> is that?


    plonk
     
    Nick Keighley, Nov 21, 2011
    #19
  20. Jo Guest

    Nick Keighley wrote:
    > On Nov 18, 9:40 am, "io_x" <> wrote:
    >> "Nick Keighley" <> ha scritto nel
    >> messaggionews:...
    >> On Nov 17, 5:35 pm, "BartC" <> wrote:
    >>> "io_x" <> wrote in message
    >>> news:4ec53d42$0$1387$...
    >>>> "" <> ha scritto nel
    >>>> messaggio
    >>>> news:...
    >>>>> In article <4ec14700$0$1387$>,
    >>>>> io_x <> wrote:

    >
    >>>>>> in the while the train go always more far from home

    >
    > <snip train gibberish>
    >
    >> [...] So io_x are you *actually* on a train or is it some
    >> sort of metaphor?

    > [...]
    >> #it is not one metatphor

    >
    > so explain what you mean or shut up about the trai
    >
    >


    You mean about how you suck so bad. It was never for you, idiot.


    I was here 2 years ago. I put away the guitar, not that I was good at it.
    I said, ("said") I will put music on hold.


    I suck at playing guitar, but ain't you still here asking me about a
    train.


    yeah, the train and me, it's none of your fucking business.

    Don't you even dare engage me, because I have nothing better to do then
    to get you out of my face.

    >> Ritchie the Fat Controller and bit fields the grumpy carriages...
    >>
    >>>> lets call one programming language X
    >>>> i thought only if instead of doing the traslation X -> x86 cpu
    >>>> is it possible doing X -> C -> all cpu
    >>>> without U.B.

    >>
    >> C as universal assembler. This is actually how a lot of langauges are
    >> implemented (at least initially). C++ was a compiler that compiled
    >> into C. the advantage of this approach is you [get] high portability
    >> but a
    >> slow compiler.
    >>
    >> #it depend what is the set of instructions you send to compiler
    >> #if they are complex or easy

    >
    > no.
    >
    >> I've also heard it said C isn't a particularly good "universal
    >> assmbler". Though I'm not entirely sure why. I think it isn't low
    >> level enough to do some of the things needed. (I tried writing a
    >> scheme (ie.lisp) interpreter in C and it was horrid C)
    >>
    >> #i don't know; i like on 32 bits unsigned, most importat
    >> u32[operators]=u32, #call32[stack],

    >
    > is that C
    >
    >> #variables definition[in the stack], jumps32, clc, stc, push32,
    >> pop32,
    >> ret_XXbits
    >> # esp for reserve memory in the stack and use it
    >> #i think with that all could be easy
    >> #where 32 means 32 bit

    >
    > that definitely isn't C. Did you read what I wrote?
     
    Jo, Nov 21, 2011
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eli Bendersky
    Replies:
    1
    Views:
    1,211
    Mike Treseler
    Mar 1, 2006
  2. Replies:
    7
    Views:
    952
  3. Surinder Singh
    Replies:
    1
    Views:
    1,255
    Richard Bos
    Dec 20, 2007
  4. Casey Hawthorne
    Replies:
    3
    Views:
    1,158
    Flash Gordon
    Nov 1, 2009
  5. Barry Schwarz

    Re: A portable stack in C

    Barry Schwarz, Nov 15, 2011, in forum: C Programming
    Replies:
    30
    Views:
    921
    David Thompson
    Jan 19, 2012
Loading...

Share This Page