Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

get rid of as much abstraction as possible :)

Options
  • 05-04-2008 11:29am
    #1
    Closed Accounts Posts: 852 ✭✭✭


    a := (1 + 2) * 5
    start high and go as low as you can :)


Comments

  • Registered Users Posts: 1,922 ✭✭✭fergalr


    If I have understood the point of this right:

    01100110101000110000111100000000


  • Closed Accounts Posts: 852 ✭✭✭blackgold>>


    I want to see your code aswell :)


  • Registered Users Posts: 1,922 ✭✭✭fergalr


    mov ax,15
    


  • Closed Accounts Posts: 852 ✭✭✭blackgold>>


    What happened to memory, variables and storing results?
    Stop cheating lol


  • Registered Users Posts: 1,922 ✭✭✭fergalr


    What happened to memory, variables and storing results?

    You didn't use any more memory or variables than I did. And the result is stored in AX, clearly.

    As far as I can see, it's quite possible a compiler would produce what I wrote, for your statement, (depending on context; it could also produce something different or even nothing at all I guess ;) )

    Essentially, all that happened was the abstraction of the higher level language was removed, i386 machine code was as low as I could think of going (without starting to draw pictures of circuits and flip flops :-) - what were you hoping for with your original question?


  • Advertisement
  • Registered Users Posts: 15,065 ✭✭✭✭Malice


    Hmm, I saw this yesterday and was confused. Today and five posts later, I'm still confused :).
    fergalr wrote: »
    what were you hoping for with your original question?
    This is exactly what I was going to ask!


  • Closed Accounts Posts: 852 ✭✭✭blackgold>>


    Ok lads I should of explained it alot better.

    What i wanted was say
    a line of c code (pyton java, haskal smalltalk ..... )
    a line of assembler code (motorola 386 ...)
    a line of hex
    a line of binary

    Just to show how abstraction has come over the years .
    And no flip flops :)


  • Registered Users Posts: 1,922 ✭✭✭fergalr


    What i wanted was say
    a line of c code (pyton java, haskal smalltalk ..... )
    a line of assembler code (motorola 386 ...)
    a line of hex
    a line of binary

    I have the solution to all of your problems...

    Now, you too can dispense with those exhaustive lookup tables and dictionaries, rid yourself of endless days of opcode lists and sleepless nights with only your mathematical calculator for company...

    Yes, this tool will do all of these functions*... and more**!

    http://gcc.gnu.org/

    *set of steak knives not included
    **has no pretensions whatever to originate anything


  • Closed Accounts Posts: 852 ✭✭✭blackgold>>


    Bought on the shopping network in '87.
    Now wheres ma code bitch:D


  • Registered Users Posts: 83,307 ✭✭✭✭Overheal


    static const short int a = 15; // ?


  • Advertisement
  • Closed Accounts Posts: 852 ✭✭✭blackgold>>


    Your only declaring a variable bud.

    a := (1 + 2) * 5

    To a human, this is a fairly simple and obvious calculation ("one plus two is three, times five is fifteen"). However, the low-level steps necessary to carry out this evaluation, and return the value "15", and then assign that value to the variable "a", are actually quite subtle and complex.

    http://en.wikipedia.org/wiki/Abstraction_(computer_science))


  • Registered Users Posts: 1,922 ✭✭✭fergalr


    Isn't
    (1 + 2) * 5
    simply a more abstract way of saying 15? I believe this is what Overheal was basing the reply on?

    Mathematically and computationally they are equivalent, as far as I can see, and I believe would get evaluated as such by a decent compiler in any higher level language.


    To me, it doesn't really make sense to me to ask for the abstraction to be removed, and then say you can't just write 15... That was the logic behind my original answer anyway. :)

    Maybe you should have asked for a = (b + c) * d; and that would have gotten replies more along the lines of what you want? (Again, it's very easy to get this output from a gcc if you ask it nicely).
    Your only declaring a variable bud.
    Yeah, but that's all you did too :-)
    To a human, this is a fairly simple and obvious calculation ("one plus two is three, times five is fifteen"). However, the low-level steps necessary to carry out this evaluation, and return the value "15", and then assign that value to the variable "a", are actually quite subtle and complex.

    Are you asking for steps required for a compiler to evaluate this? That would seem to be a different question..?


  • Closed Accounts Posts: 852 ✭✭✭blackgold>>


    Apples


  • Registered Users Posts: 83,307 ✭✭✭✭Overheal


    fergalr wrote: »
    Isn't

    simply a more abstract way of saying 15? I believe this is what Overheal was basing the reply on?

    Mathematically and computationally they are equivalent, as far as I can see, and I believe would get evaluated as such by a decent compiler in any higher level language.


    To me, it doesn't really make sense to me to ask for the abstraction to be removed, and then say you can't just write 15... That was the logic behind my original answer anyway. :)

    Maybe you should have asked for a = (b + c) * d; and that would have gotten replies more along the lines of what you want? (Again, it's very easy to get this output from a gcc if you ask it nicely).


    Yeah, but that's all you did too :-)



    Are you asking for steps required for a compiler to evaluate this? That would seem to be a different question..?

    I saw 15. What can I say. Im hardly the tallest element in the stack when it comes to programming :pac:


Advertisement