C to Java Byte Code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • joe@invalid.address

    #46
    Re: C to Java Byte Code

    Paul Lutus <nospam@nosite. zzz> writes:
    [color=blue]
    > Mohd Hanafiah Abdullah wrote:
    >[color=green]
    > > In article <10nqamhfej8qqf 5@corp.supernew s.com>,
    > > Paul Lutus <nospam@nosite. zzz> wrote:[/color][/color]
    [color=blue][color=green]
    > > Excuse me, but unions are supported in the product being discussed.[/color]
    >
    > Post the byte code in which a Java float is united with a Java
    > integer. Or retract your statement.
    >
    > Unions are not supported in your product. A C union is a joining of
    > two or more distinct variable types with simultaneous access to
    > both, e.g. it is an example of a memory block shared between data
    > types. This is not allowed in Java because of strong typing.[/color]

    It's not allowed in C/C++ either. Accessing a union member as anything
    other than what it was last written as is undefined.

    Joe
    --
    Nothing cures like time and love
    - Laura Nyro

    Comment

    • boa

      #47
      Re: C to Java Byte Code

      joe@invalid.add ress wrote:
      [color=blue]
      > Paul Lutus <nospam@nosite. zzz> writes:
      >
      >[color=green]
      >>Mohd Hanafiah Abdullah wrote:
      >>
      >>[color=darkred]
      >>>In article <10nqamhfej8qqf 5@corp.supernew s.com>,
      >>>Paul Lutus <nospam@nosite. zzz> wrote:[/color][/color]
      >
      >[color=green][color=darkred]
      >>>Excuse me, but unions are supported in the product being discussed.[/color]
      >>
      >>Post the byte code in which a Java float is united with a Java
      >>integer. Or retract your statement.
      >>
      >>Unions are not supported in your product. A C union is a joining of
      >>two or more distinct variable types with simultaneous access to
      >>both, e.g. it is an example of a memory block shared between data
      >>types. This is not allowed in Java because of strong typing.[/color]
      >
      >
      > It's not allowed in C/C++ either. Accessing a union member as anything
      > other than what it was last written as is undefined.
      >
      > Joe[/color]

      <C>
      Is it undefined or unspecified? Annex J.1 in C99, page 488, lists "The
      value of a union member other than the last one stored into", as
      unspecified and refers to ยง6.2.6.1.

      I'm not asking just to be a PITA, but because I recently spent at least
      an hour browsing the standard for the chapter&verse which said that it
      was undefined. Couldn't find anything except J.1.
      </C>

      boa


      Comment

      • Gerry Quinn

        #48
        Re: C to Java Byte Code

        In article <10ns45fm1agi65 2@corp.supernew s.com>, nospam@nosite.z zz
        says...

        [My apologies for accidental double post on comp.lang.c. Mr. Lutus is
        now attempting to escape his embarrasment by silently changing follow-
        ups.]
        [color=blue]
        > Keith Thompson wrote:[color=green]
        > > Paul Lutus <nospam@nosite. zzz> writes:[/color][/color]

        typedef union abc
        { int x;
        float y;
        } a_union;
        [color=blue][color=green][color=darkred]
        > >> 2. This is not a union, it it two instances of the same variable. Again,
        > >> to reply to my post, you need to provide the Java bytecode that unites a
        > >> Java float and a Java integer in the same address space, something that
        > >> is not allowed in Java.[/color][/color][/color]

        Of course it's a union. It has two members x and y which are in this
        instance of different types, although that is by no means part of the
        specification.

        Within the C program of which the above is a fragment, the data stored
        in an instance of the union can be referenced as an int or a float, and
        will be interpreted in the appropriate manner. THAT IS ALL. NOTHING
        ELSE IS TO BE EXPECTED ACCORDING TO THE DEFINITION OF THE C LANGUAGE.

        You can use it as a structured way to store variant data types compactly
        (the basic function of unions), or you can use it in a hackerish way to
        investigate data storage on a target system and implementation. You
        used it in the latter fashion and for some reason you didn't like the
        results. But it worked just fine. C doesn't make any promises about
        the results of reinterpreting disparate types.
        [color=blue][color=green]
        > > How is this not a union? What do you think a union is, anyway?[/color]
        >
        > A union is two or more disparate variable types that share the same memory
        > space. Because of its strong data typing, Java simply doesn't allow this.
        > As a result, the program in question has to jump through hoops to pretend
        > to support a union such as is imagined to exist in the above examples and
        > those I provided earlier.[/color]

        There is no reason at all why the types should have to be be disparate,
        although in this case they are, albeit their representations currently
        happen to be the same size. And Java and its strong typing are
        completely irrelevant, just as irrelevant as the details of whatever CPU
        is running a compiled version of the C program containing the union
        definition above. Neither bytecode nor machine code has unions. Unions
        are a feature of C, not of compiled executables.

        - Gerry Quinn





        Comment

        • Richard Herring

          #49
          Re: C to Java Byte Code

          In message <MPG.1be88430bd 2306c989a5d@new s.indigo.ie>, Gerry Quinn
          <gerryq@DELETET HISindigo.ie> writes[color=blue]
          >In article <10ns45fm1agi65 2@corp.supernew s.com>, nospam@nosite.z zz
          >says...
          >
          >[My apologies for accidental double post on comp.lang.c. Mr. Lutus is
          >now attempting to escape his embarrasment by silently changing follow-
          >ups.][/color]

          Since you're not discussing C++, please spare comp.lang.c++ the rest of
          this thread.

          Followups set.

          --
          Richard Herring

          Comment

          • Paul Lutus

            #50
            Re: C to Java Byte Code

            Gerry Quinn wrote:
            [color=blue]
            > In article <10ns45fm1agi65 2@corp.supernew s.com>, nospam@nosite.z zz
            > says...
            >
            > [My apologies for accidental double post on comp.lang.c. Mr. Lutus is
            > now attempting to escape his embarrasment by silently changing follow-
            > ups.]
            >[color=green]
            >> Keith Thompson wrote:[color=darkred]
            >> > Paul Lutus <nospam@nosite. zzz> writes:[/color][/color]
            >
            > typedef union abc
            > { int x;
            > float y;
            > } a_union;
            >[color=green][color=darkred]
            >> >> 2. This is not a union, it it two instances of the same variable.
            >> >> Again, to reply to my post, you need to provide the Java bytecode that
            >> >> unites a Java float and a Java integer in the same address space,
            >> >> something that is not allowed in Java.[/color][/color]
            >
            > Of course it's a union. It has two members x and y which are in this
            > instance of different types, although that is by no means part of the
            > specification.[/color]

            Yes, it is a union in C, but I am saying it is not a union in the Java
            bytecode. You have made this appear to be the meaning of my statement by
            concatenating two unconnected parts of posts, creating the illusion of a
            sequence that was not present in the original.

            This intentional misquote unermines your entire post. My statement is
            clearly that, since Java doesn't support anything like a union, the product
            doesn't create unions as its output, it can only read them from the C
            source and then figure out what to do with them. What it produces in Java
            bytecode is not a union. And, more to the point, what it does produce
            behaves differently than the original C code does.

            --
            Paul Lutus
            A site for people who think. Intellectual resources, programming, astronomy, science, mathematics, Java/JavaScript applets, programming instruction, home of Arachnophilia.


            Comment

            • Willem

              #51
              Re: C to Java Byte Code

              Paul wrote:
              ) Yes, it is a union in C, but I am saying it is not a union in the Java
              ) bytecode.

              It doesnt *need* to be a union in the Java bytecode, you moron.

              In case you hadn't noticed, if I compile a piece of C codes with unions
              with, say, gcc, then the resulting assembly code does *not* have unions.


              SaSW, Willem
              --
              Disclaimer: I am in no way responsible for any of the statements
              made in the above text. For all I know I might be
              drugged or something..
              No I'm not paranoid. You all think I'm paranoid, don't you !
              #EOT

              Comment

              • E. Robert Tisdale

                #52
                Welcome back Paul Lutus

                Paul Lutus wrote:

                [snip]

                Hi Paul,

                Welcome back to the comp.lang.c and comp.lang.c++ newsgroups.
                I checked Google newsgroups.



                You've been absent from comp.lang.c++ since October 20, 2003
                and absent from comp.lang.c since May 30,2002.

                No matter. Very little has changed since you've been gone. :-)

                Comment

                • Mark McIntyre

                  #53
                  Re: C to Java Byte Code

                  On Tue, 26 Oct 2004 11:36:02 -0700, in comp.lang.c , Paul Lutus
                  <nospam@nosite. zzz> wrote:
                  [color=blue]
                  >Yes, it is a union in C, but I am saying it is not a union in the Java
                  >bytecode.[/color]

                  Marvellous. Since this has nothing to do with C any more, why the heck are
                  you stupidly crossposting this long and pointless thread in CLC and CLC++.
                  Go away.

                  --
                  Mark McIntyre
                  CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
                  CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >


                  ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
                  http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
                  ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

                  Comment

                  • E. Robert Tisdale

                    #54
                    Troll Alert: C to Java Byte Code

                    Mark McIntyre wrote:
                    [color=blue]
                    > Paul Lutus wrote:
                    >[color=green]
                    >>Yes, it is a union in C,
                    >>but I am saying it is not a union in the Java bytecode.[/color]
                    >
                    > Marvellous. Since this has nothing to do with C any more,
                    > why the heck are you stupidly crossposting this long and pointless thread
                    > in CLC and CLC++.
                    > Go away.[/color]

                    Why are you responding to a post
                    that you obviously think is a troll?
                    Honestly,
                    I don't see any difference between you and Paul Lutus
                    and I don't know which one of you is worse
                    I think that you are both trolls
                    and I'll bet that most other subscribers think so too.

                    Comment

                    • Old Wolf

                      #55
                      Re: C to Java Byte Code

                      Paul Lutus <nospam@nosite. zzz> wrote:[color=blue]
                      > Show us the bytecode that overlays a Java float and a Java integer into the
                      > same memory space. That is what a union is.[/color]

                      Sorry, you are wrong. There is no requirement in the C standard for
                      the members of the union to occupy the same piece of memory.
                      If you disagree then please quote a standard reference.
                      (They must all return the same thing when their address is
                      taken and then converted to (void *), but it does not follow
                      from that that they occupy the same physical memory).
                      [color=blue]
                      > Show us the Java bytecode that allows one to manipulate
                      > individual bits of a Java float datatype, as a C union allows.[/color]

                      A C union does not allow that. Any C program that
                      relies on it is non-portable.

                      The following results are conforming to the C specification
                      (note, this is a minor modification of a program posted
                      elsewhere in the thread):

                      #include <stdio.h>

                      typedef union abc
                      { int x;
                      float y;
                      } a_union;

                      main()
                      { a_union z;

                      z.x = 1;
                      printf("int val = %d\n", z.x);
                      printf("float val = %f\n", z.y);

                      z.y = 3.142;
                      printf("int val = %d\n", z.x);
                      printf("float val = %f\n", z.y);
                      return 0;
                      }

                      Results:
                      int val = 1
                      float val = 3.142
                      int val = 1
                      float val = 3.142

                      Comment

                      • Paul Lutus

                        #56
                        Re: C to Java Byte Code

                        Mark McIntyre wrote:
                        [color=blue]
                        > On Tue, 26 Oct 2004 11:36:02 -0700, in comp.lang.c , Paul Lutus
                        > <nospam@nosite. zzz> wrote:
                        >[color=green]
                        >>Yes, it is a union in C, but I am saying it is not a union in the Java
                        >>bytecode.[/color]
                        >
                        > Marvellous. Since this has nothing to do with C any more,[/color]

                        Do you see a reference to C in the sentence above? No? Is there an
                        optometrist available in your neighborhood?

                        The discussion is about a C to Java cross-compiler. Both languages are
                        therefore topical.
                        [color=blue]
                        > why the heck are
                        > you stupidly crossposting this long and pointless thread in CLC and CLC++.[/color]

                        The OP, an unscrupulous, predatory commercial vendor, created this
                        cross-posted thread. If you don't like it, argue with him.
                        [color=blue]
                        > Go away.[/color]

                        Do the world a favor. Killfile Usenet.

                        --
                        Paul Lutus
                        A site for people who think. Intellectual resources, programming, astronomy, science, mathematics, Java/JavaScript applets, programming instruction, home of Arachnophilia.


                        Comment

                        • Paul Lutus

                          #57
                          Re: C to Java Byte Code

                          Willem wrote:
                          [color=blue]
                          > Paul wrote:
                          > ) Yes, it is a union in C, but I am saying it is not a union in the Java
                          > ) bytecode.
                          >
                          > It doesnt *need* to be a union in the Java bytecode, you moron.[/color]

                          The claim made by Mr. Abdullah is that unions are supported by his product.
                          Since unions are already supported in C, this can only mean his claim
                          refers to Java. But Java does not support unions, and you cannot force Java
                          to accept anything resembling a union. What you can do is switch data back
                          and forth using existing getter and setter methods for some data types, but
                          this masquerade will not always work, as has been shown in this and the
                          prior thread.
                          [color=blue]
                          > In case you hadn't noticed, if I compile a piece of C codes with unions
                          > with, say, gcc, then the resulting assembly code does *not* have unions.[/color]

                          In case you haven't noticed, you have lost the ability to post anything of
                          any use to anyone. This is why you find it necessary to leave the topic
                          with such regularity -- it induces in your fingers a belief that your brain
                          is still online.

                          --
                          Paul Lutus
                          A site for people who think. Intellectual resources, programming, astronomy, science, mathematics, Java/JavaScript applets, programming instruction, home of Arachnophilia.


                          Comment

                          • Paul Lutus

                            #58
                            Re: C to Java Byte Code

                            Old Wolf wrote:
                            [color=blue]
                            > Paul Lutus <nospam@nosite. zzz> wrote:[color=green]
                            >> Show us the bytecode that overlays a Java float and a Java integer into
                            >> the same memory space. That is what a union is.[/color]
                            >
                            > Sorry, you are wrong. There is no requirement in the C standard for
                            > the members of the union to occupy the same piece of memory.[/color]

                            I never said it was a requirement. What I said is quoted clearly above your
                            targetless demurrer.
                            [color=blue]
                            > If you disagree then please quote a standard reference.[/color]



                            "Because they occupy the same space, changing u.a also changes the value of
                            u.b."

                            "The primary usefulness of a union is to conserve space, since it provides a
                            way of letting many different types be stored in the same space."

                            There are plenty of similar references, but beyond this, I am not going to
                            waste my time disabusing you of your misconception. I am sure that, were
                            you inclined, you could find and read your own definitions.
                            [color=blue]
                            > (They must all return the same thing when their address is
                            > taken and then converted to (void *), but it does not follow
                            > from that that they occupy the same physical memory).[/color]

                            This is not required, but then, that claim was never made.
                            [color=blue][color=green]
                            >> Show us the Java bytecode that allows one to manipulate
                            >> individual bits of a Java float datatype, as a C union allows.[/color]
                            >
                            > A C union does not allow that.[/color]

                            It certainly does.
                            [color=blue]
                            > Any C program that
                            > relies on it is non-portable.[/color]

                            Non sequitur. It is a question of syntactic correctness, not portability.

                            --
                            Paul Lutus
                            A site for people who think. Intellectual resources, programming, astronomy, science, mathematics, Java/JavaScript applets, programming instruction, home of Arachnophilia.


                            Comment

                            • Thomas G. Marshall

                              #59
                              Re: C to Java Byte Code

                              Willem coughed up:

                              ....[rip]...
                              [color=blue]
                              > I assume you understood that perfectly and, unable to respond to the
                              > actual argument, chose this ad hominem approach instead.[/color]

                              ....[rip]...
                              [color=blue]
                              > You must be trolling, [...][/color]


                              I don't believe that he is trolling per se, but you should recognize his
                              descent into insulting attacks and hand-waving as his standard MO and place
                              him in your killfile asap.

                              ....[rip]...


                              --
                              Framsticks. 3D Artificial Life evolution. You can see the creatures
                              that evolve and how they interact, hunt, swim, etc. (Unaffiliated with
                              me). http://www.frams.alife.pl/


                              Comment

                              • Thomas G. Marshall

                                #60
                                Re: C to Java Byte Code

                                CBFalconer coughed up:[color=blue]
                                > Paul Lutus wrote:[color=green]
                                >> Willem wrote:
                                >>[/color]
                                > ... snip ...[color=green]
                                >>[color=darkred]
                                >>> ) But if they are both Java native integers, no mapping is taking
                                >>> place. If ) there are two accesses to a simple integer value, the
                                >>> term "mapping" is not ) appropriate, but if a C union is provided
                                >>> and two different data types are ) mapped/conjoined, the term in[/color]
                                >>
                                >> You really need to set up your newsreader properly. Use this post
                                >> as an example of standard quoting style.[/color]
                                >
                                > His problem is extremely simple - stop using a non-standard quote
                                > character. The standard is '>', not ')'.[/color]

                                I agree---there might be news readers that otherwise offer the ability to
                                reformat replied indented paragraphs into non-broken lines. Furthermore,
                                /most/ offer the ability to color the paragraphs based upon indent level,
                                making it much easier to read, like OE_QuoteFix does for my OE.

                                This ")" business is a rude train wreck.

                                --
                                Framsticks. 3D Artificial Life evolution. You can see the creatures
                                that evolve and how they interact, hunt, swim, etc. (Unaffiliated with
                                me). http://www.frams.alife.pl/


                                Comment

                                Working...