The D programming language

2

Comments

  • : :
    : : But inline asm is very much compiler indepedent, the syntax, right? Or was it not made standard at the time because asm varies from machine to machine?
    : : {2}rIng
    : :
    :
    :
    : inline is very much compiler dependent -- each compiler implements it in different ways even for the same target system. asm is very much NON-PORTABLE, so if you plan to compile a program with different compilers and/or for different target platforms, then do not use it at all. besides, most good optimizing compilers today produce very efficient assembly code, so rolling your own assembly is not very worthwhile today.
    :
    :
    Sometimes it's easier to just use some inline asm isntead of downloading some big library that only takes up space.
    Like the CPUID instruction.

    Does all compilers support intel syntax and the other (can't remember the name) syntax?
  • [b][red]This message was edited by stober at 2006-6-27 10:19:4[/red][/b][hr]
    :
    : Does all compilers support intel syntax and the other (can't remember the name) syntax?
    :


    No. Intel is only supported in Intel computers. Many compilers compile for RISK, ARM, and hundreds of other CPUs and they look nothing like 80x88 assembly.

    attempting to avoid linking with some libraries is a poor excuse for using assembly. linkers only bring into your program those portions of the library that are needed to resolve all references. If function foo() is in the library, is in its own object file, and not referenced anywhere then the linker will just ignore it.

    Some linkers go even further than that -- they will toss out code that is not referenced anywhere in the program even though it may be compiled in an object file with other functions that are used, even unused code in your own program


    for CPUID instruction you don't need assembly at all, M$ compilers have a function _cpuid().
    http://msdn2.microsoft.com/en-us/library/hskdteyh.aspx


  • : I guess, but it matters what ur doing.
    :
    : Lundin dude, you probably didn't read the wikipedia description. You actually have the option of turning off the garbage collection for either parts of the program or the entire program. I think it said you could also put explicitly instantiate/remove objects with the C functions (malloc()/realloc())
    :
    : Thats what makes D special (not as a replacement). I actually read this in the specs a while ago. It said it was a practical language. It gives high level features, but leaves the low level because sometimes its needed. Like it said how its features can make programming in it possible without pointers, but pointers weren't left out, he kept it because there are exceptions.
    :
    : Not as a replacement though. I still like C/C++. I think I'll look at D a little longer just to see what is like.
    : {2}rIng
    :
    [green]
    Don't look at it as it's better than this or that. Learn one language backwards and forwards because if you know one really well then the others will be just the same old stuff in a different syntax.

    Why would you want to program without pointers? Seems strange to me.
    [/green]

  • : [b][red]This message was edited by stober at 2006-6-27 10:19:4[/red][/b][hr]
    : :
    : : Does all compilers support intel syntax and the other (can't remember the name) syntax?
    : :
    :
    :
    : No. Intel is only supported in Intel computers. Many compilers compile for RISK, ARM, and hundreds of other CPUs and they look nothing like 80x88 assembly.

    You got me all wrong, is it possible to use intel SYNTAX was my Q, nothing else.

    The intel syntax is like this:
    mov ax, bx
    wich will move bx into ax
    while the other syntax is like this:
    mov %bx, %ax
    wich will do the same as the one above.

    The other syntax is a pain for me, becouse everything is reversed.

    :
    : for CPUID instruction you don't need assembly at all, M$ compilers have a function _cpuid().
    : http://msdn2.microsoft.com/en-us/library/hskdteyh.aspx
    :

    I use gcc, and I could't find it.
  • : : I guess, but it matters what ur doing.
    : :
    : : Lundin dude, you probably didn't read the wikipedia description. You actually have the option of turning off the garbage collection for either parts of the program or the entire program. I think it said you could also put explicitly instantiate/remove objects with the C functions (malloc()/realloc())
    : :
    : : Thats what makes D special (not as a replacement). I actually read this in the specs a while ago. It said it was a practical language. It gives high level features, but leaves the low level because sometimes its needed. Like it said how its features can make programming in it possible without pointers, but pointers weren't left out, he kept it because there are exceptions.
    : :
    : : Not as a replacement though. I still like C/C++. I think I'll look at D a little longer just to see what is like.
    : : {2}rIng
    : :
    : [green]
    : Don't look at it as it's better than this or that. Learn one language backwards and forwards because if you know one really well then the others will be just the same old stuff in a different syntax.
    :
    : Why would you want to program without pointers? Seems strange to me.
    : [/green]
    :
    :
    Without pointers it's impossible to access the wrong memmory (aka segmentation fault in unix) (if the arrays are controlled too).
  • : : : I guess, but it matters what ur doing.
    : : :
    : : : Lundin dude, you probably didn't read the wikipedia description. You actually have the option of turning off the garbage collection for either parts of the program or the entire program. I think it said you could also put explicitly instantiate/remove objects with the C functions (malloc()/realloc())
    : : :
    : : : Thats what makes D special (not as a replacement). I actually read this in the specs a while ago. It said it was a practical language. It gives high level features, but leaves the low level because sometimes its needed. Like it said how its features can make programming in it possible without pointers, but pointers weren't left out, he kept it because there are exceptions.
    : : :
    : : : Not as a replacement though. I still like C/C++. I think I'll look at D a little longer just to see what is like.
    : : : {2}rIng
    : : :
    : : [green]
    : : Don't look at it as it's better than this or that. Learn one language backwards and forwards because if you know one really well then the others will be just the same old stuff in a different syntax.
    : :
    : : Why would you want to program without pointers? Seems strange to me.
    : : [/green]
    : :
    : :
    : Without pointers it's impossible to access the wrong memmory (aka segmentation fault in unix) (if the arrays are controlled too).
    :

    [green]
    Hmmm, I didn't realize pointers were that hard to keep track of.
    [/green]

  • : : : : I guess, but it matters what ur doing.
    : : : :
    : : : : Lundin dude, you probably didn't read the wikipedia description. You actually have the option of turning off the garbage collection for either parts of the program or the entire program. I think it said you could also put explicitly instantiate/remove objects with the C functions (malloc()/realloc())
    : : : :
    : : : : Thats what makes D special (not as a replacement). I actually read this in the specs a while ago. It said it was a practical language. It gives high level features, but leaves the low level because sometimes its needed. Like it said how its features can make programming in it possible without pointers, but pointers weren't left out, he kept it because there are exceptions.
    : : : :
    : : : : Not as a replacement though. I still like C/C++. I think I'll look at D a little longer just to see what is like.
    : : : : {2}rIng
    : : : :
    : : : [green]
    : : : Don't look at it as it's better than this or that. Learn one language backwards and forwards because if you know one really well then the others will be just the same old stuff in a different syntax.
    : : :
    : : : Why would you want to program without pointers? Seems strange to me.
    : : : [/green]
    [red]
    EXACTLY! read the second paragraph...again. Its possible not to use pointers for those who want to program without fear of segmentation faults as NIklas said, but pointers are still included. Why? THe second paragraph tells why.
    {2}rIng
    [/red]
  • : : : : : I guess, but it matters what ur doing.
    : : : : :
    : : : : : Lundin dude, you probably didn't read the wikipedia description. You actually have the option of turning off the garbage collection for either parts of the program or the entire program. I think it said you could also put explicitly instantiate/remove objects with the C functions (malloc()/realloc())
    : : : : :
    : : : : : Thats what makes D special (not as a replacement). I actually read this in the specs a while ago. It said it was a practical language. It gives high level features, but leaves the low level because sometimes its needed. Like it said how its features can make programming in it possible without pointers, but pointers weren't left out, he kept it because there are exceptions.
    : : : : :
    : : : : : Not as a replacement though. I still like C/C++. I think I'll look at D a little longer just to see what is like.
    : : : : : {2}rIng
    : : : : :
    : : : : [green]
    : : : : Don't look at it as it's better than this or that. Learn one language backwards and forwards because if you know one really well then the others will be just the same old stuff in a different syntax.
    : : : :
    : : : : Why would you want to program without pointers? Seems strange to me.
    : : : : [/green]
    : [red]
    : EXACTLY! read the second paragraph...again. Its possible not to use pointers for those who want to program without fear of segmentation faults as NIklas said, but pointers are still included. Why? THe second paragraph tells why.
    : {2}rIng
    : [/red]
    :

    [green]
    I understood the 2nd paragraph fine. My point is, why would you want to program without pointers and IDK responded. I'm sorry, is there a problem with you understanding that?
    [/green]

  • : : : : : : I guess, but it matters what ur doing.
    : : : : : :
    : : : : : : Lundin dude, you probably didn't read the wikipedia description. You actually have the option of turning off the garbage collection for either parts of the program or the entire program. I think it said you could also put explicitly instantiate/remove objects with the C functions (malloc()/realloc())
    : : : : : :
    : : : : : : Thats what makes D special (not as a replacement). I actually read this in the specs a while ago. It said it was a practical language. It gives high level features, but leaves the low level because sometimes its needed. Like it said how its features can make programming in it possible without pointers, but pointers weren't left out, he kept it because there are exceptions.
    : : : : : :
    : : : : : : Not as a replacement though. I still like C/C++. I think I'll look at D a little longer just to see what is like.
    : : : : : : {2}rIng
    : : : : : :
    : : : : : [green]
    : : : : : Don't look at it as it's better than this or that. Learn one language backwards and forwards because if you know one really well then the others will be just the same old stuff in a different syntax.
    : : : : :
    : : : : : Why would you want to program without pointers? Seems strange to me.
    : : : : : [/green]
    : : [red]
    : : EXACTLY! read the second paragraph...again. Its possible not to use pointers for those who want to program without fear of segmentation faults as NIklas said, but pointers are still included. Why? THe second paragraph tells why.
    : : {2}rIng
    : : [/red]
    : :
    :
    : [green]
    : I understood the 2nd paragraph fine. My point is, why would you want to program without pointers and IDK responded. I'm sorry, is there a problem with you understanding that?
    : [/green]
    :
    :
    [red]
    Oh...eh heh heh heh, sorry about that. Yeah, some individuals find having to care about pointers distracting, that is distracting from their algorithm, what they really are trying to do.

    There are logical languages that do that completely though, as if your not even programming anymore. I think Prolog is one, I heard of another based on C, but I forgot what it was.

    Other languages like Java and C# replace pointers with more safe, more innocent "references" (you can tell by the name), although in C#, I think u can use pointers, but its not recommended...references are indeed pointers, but you can't just add or subtract them with normal integer or any values and still use it as a pointer, like

    this is legal in C

    int *p=&q;
    p+=3;

    but in Java,

    Object p;//this is a "reference"
    p+=4;//you can't do that, I think

    Personally, I like pointers, and I actually use the pointer arithmetic like p+a rather than &p[a], it can be clearer, depending on what you see it as.
    {2}rIng
    [/red]

  • : [red]
    : Oh...eh heh heh heh, sorry about that. Yeah, some individuals find having to care about pointers distracting, that is distracting from their algorithm, what they really are trying to do.

    [blue]I believe they are called newbies... :-)[/blue]

    :
    : There are logical languages that do that completely though, as if your not even programming anymore. I think Prolog is one, I heard of another based on C, but I forgot what it was.
    :
    : Other languages like Java and C# replace pointers with more safe, more innocent "references"

    [blue]They are not so innocent. You can still mess up quite a lot when assigning one object to another.

    Anyway, you don't -have- to use pointers in C/C++ either. But if you don't, you will end up with a way less powerful language. This whole pointer-phobia is created by people that don't how pointers work. And naturally, if you don't know how to use something, but sill use it, yeah then there will be bugs.
    [/blue]
  • [b][red]This message was edited by IDK at 2006-6-28 4:13:1[/red][/b][hr]
    : : [red]
    : : There are logical languages that do that completely though, as if your not even programming anymore. I think Prolog is one, I heard of another based on C, but I forgot what it was.
    : :
    : : Other languages like Java and C# replace pointers with more safe, more innocent "references"
    : [/red]
    : [blue]They are not so innocent. You can still mess up quite a lot when assigning one object to another.
    : [/blue]


    As gregry tried to explain, references in languages like C# and java are innocent.


  • 10 posts reached...

    : [b][red]This message was edited by IDK at 2006-6-28 4:13:1[/red][/b][hr]
    : : : [red]
    : : : There are logical languages that do that completely though, as if your not even programming anymore. I think Prolog is one, I heard of another based on C, but I forgot what it was.
    : : :
    : : : Other languages like Java and C# replace pointers with more safe, more innocent "references"
    : : [/red]
    : : [blue]They are not so innocent. You can still mess up quite a lot when assigning one object to another.
    : : [/blue]
    :
    :
    : As gregry tried to explain, references in languages like C# and java are innocent.
    :

    I ment those as well. And no, they aren't... this is what I ment:

    (pseudo code)

    [code]
    someFunction(Object byref obj1, Object byref obj2)
    {
    obj1 = obj2;
    }
    [/code]

    Will the code copy the address or the value here? It is not very obvious and depends on the language. Iirc Java treats common objects in one way and primitive data types + the String object in another way.
  • : 10 posts reached...
    :
    : : [b][red]This message was edited by IDK at 2006-6-28 4:13:1[/red][/b][hr]
    : : : : [red]
    : : : : There are logical languages that do that completely though, as if your not even programming anymore. I think Prolog is one, I heard of another based on C, but I forgot what it was.
    : : : :
    : : : : Other languages like Java and C# replace pointers with more safe, more innocent "references"
    : : : [/red]
    : : : [blue]They are not so innocent. You can still mess up quite a lot when assigning one object to another.
    : : : [/blue]
    : :
    : :
    : : As gregry tried to explain, references in languages like C# and java are innocent.
    : :
    :
    : I ment those as well. And no, they aren't... this is what I ment:
    :
    : (pseudo code)
    :
    : [code]
    : someFunction(Object byref obj1, Object byref obj2)
    : {
    : obj1 = obj2;
    : }
    : [/code]
    :
    : Will the code copy the address or the value here? It is not very obvious and depends on the language. Iirc Java treats common objects in one way and primitive data types + the String object in another way.
    :
    It depends on if the value is saved as a value (what I would call a struct) or as a pointer to a value (what I would call a class).
  • : : 10 posts reached...
    : :
    : : : [b][red]This message was edited by IDK at 2006-6-28 4:13:1[/red][/b][hr]
    : : : : : [red]
    : : : : : There are logical languages that do that completely though, as if your not even programming anymore. I think Prolog is one, I heard of another based on C, but I forgot what it was.
    : : : : :
    : : : : : Other languages like Java and C# replace pointers with more safe, more innocent "references"
    : : : : [/red]
    : : : : [blue]They are not so innocent. You can still mess up quite a lot when assigning one object to another.
    : : : : [/blue]
    : : :
    : : :
    : : : As gregry tried to explain, references in languages like C# and java are innocent.
    : : :
    : :
    : : I ment those as well. And no, they aren't... this is what I ment:
    : :
    : : (pseudo code)
    : :
    : : [code]
    : : someFunction(Object byref obj1, Object byref obj2)
    : : {
    : : obj1 = obj2;
    : : }
    : : [/code]
    : :
    : : Will the code copy the address or the value here? It is not very obvious and depends on the language. Iirc Java treats common objects in one way and primitive data types + the String object in another way.
    : :
    : It depends on if the value is saved as a value (what I would call a struct) or as a pointer to a value (what I would call a class).
    :

    With "byref" I mean that the parameters are passed by reference. But the programmer wants to copy the value from obj2 to obj1. The result would vary depending on language:

    C: the address is copied (pointers).
    C++: the value is copied. The = operator is called.
    Java: the address is copied (unless it is a String iirc)
    C#: should be the same as C++?
  • : : :
    : : : Will the code copy the address or the value here? It is not very obvious and depends on the language. Iirc Java treats common objects in one way and primitive data types + the String object in another way.
    : : :
    : : It depends on if the value is saved as a value (what I would call a struct) or as a pointer to a value (what I would call a class).
    : :
    :
    : With "byref" I mean that the parameters are passed by reference. But the programmer wants to copy the value from obj2 to obj1. The result would vary depending on language:
    :
    : C: the address is copied (pointers).
    : C++: the value is copied. The = operator is called.
    : Java: the address is copied (unless it is a String iirc)
    : C#: should be the same as C++?
    :

    I see your point now.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories