Announcement

Collapse
No announcement yet.

Programming question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #76
    Originally posted by Hauldren Collider View Post
    In C I just use the goto's for efficiency, much faster that way.


    I heard about this loop unrolling thing but it sounded like some toilet paper related activity and ever since my car was covered in toilet paper I have a crippling fear of it.
    "gotos" tend to be significantly slower with any decent compiler. They do loop detection, not goto detection. Even modern processors like the Core 2s (and even more in the Core i-series) do intense branch prediction with loop detection.

    Compilers, though, are the main reasons. They'll not only automatically "unroll" loops, but they can tell when it's better to unroll the loop or keep it as is (computing the potential tradeoffs), etc. Also, consider using the "inline" keyword to hint to the compiler to inline the function. Keeps your code clean without the function jumping overhead.
    "The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
    Ben Kenobi: "That means I'm doing something right. "

    Comment


    • #77
      Originally posted by Asher View Post



      "gotos" tend to be significantly slower with any decent compiler. They do loop detection, not goto detection. Even modern processors like the Core 2s (and even more in the Core i-series) do intense branch prediction with loop detection.

      Compilers, though, are the main reasons. They'll not only automatically "unroll" loops, but they can tell when it's better to unroll the loop or keep it as is (computing the potential tradeoffs), etc. Also, consider using the "inline" keyword to hint to the compiler to inline the function. Keeps your code clean without the function jumping overhead.
      I actually know all of this Asher.

      Although I didn't know the inline thing. But I never actually use gotos*...so whatever

      *So I actually used them once last year to escape a doubly nested loop.
      I do this in python my throwing an exception and catching it outside the loop. I'm horrible.

      EDIT: Looks like inlines are just what I used macros for
      If there is no sound in space, how come you can hear the lasers?
      ){ :|:& };:

      Comment


      • #78
        Originally posted by Kuciwalker View Post
        Do you know what the difference is between:

        Code:
        for (int i = 0; i < x.length; i++) {
            System.out.println(x[i]);
        }
        and

        Code:
        for (int i = 0; i < x.size(); i++) {
            System.out.println(x.get(i));
        }
        ?

        The second one isn't obsolete as of this century.
        Christ, you continue with this. Though, if you really want, then I can find an implementation of the latter at wtf that will want you to kill someone.
        With or without religion, you would have good people doing good things and evil people doing evil things. But for good people to do evil things, that takes religion.

        Steven Weinberg

        Comment


        • #79
          What language did you guys first start off with? Also, what do you use it for right now? Finally, do you guys have experience with hooking programs and debugging them and then writing exploits for them? The reality is I don't have much use for programming with what I'm going to be doing for the most part, but I kind of like it even though I hate Java. That being said, hooking programs and then debugging them to write exploits for them really appeals to me. I started to dabble in it during the summer and jumped into some assembly and C++. Something I plan on learning probably over the next couple of years while I work.

          Comment


          • #80
            Originally posted by DriXnaK View Post
            What language did you guys first start off with?
            I taught myself C++ in Jr High. If you count plugging around in BASIC a bit (nothing serious), then it goes back to elementary school.

            Also, what do you use it for right now?
            What do you think?

            Finally, do you guys have experience with hooking programs and debugging them and then writing exploits for them?
            I've toyed with this, mostly in my earlier university days (I even bought a couple hacking books), but it's not very interesting to me and it's particularly challenging today with any well-designed app. Back in the good ol' days all you had to do was trigger buffer overflows...

            The reality is I don't have much use for programming with what I'm going to be doing for the most part, but I kind of like it even though I hate Java. That being said, hooking programs and then debugging them to write exploits for them really appeals to me. I started to dabble in it during the summer and jumped into some assembly and C++. Something I plan on learning probably over the next couple of years while I work.
            I do not understand the appeal for security experts to learn Java. You should be writing C and dealing with raw sockets, memory allocation and (mis)management, getting your hands dirty with how memory works in a system and how to exploit poorly designed programs. You don't learn any of this with Java, which is too high-level and VM-specific to be of any use in security.
            "The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
            Ben Kenobi: "That means I'm doing something right. "

            Comment


            • #81
              Let's be realistic: if you're getting a "degree" in IT security, you're not going to be finding exploits in programs. It's surprisingly hard and you need a particularly sharp mind with an unusually common understanding of how computers and operating systems actually work. You also need to be very, very patient.

              People who go through IT security programs end up getting employed as "IT security" people in corporations. This means staying on top of malware bulletins, installing patches, upgrading server software, configuring firewalls, enforcing password changes, etc.
              "The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
              Ben Kenobi: "That means I'm doing something right. "

              Comment


              • #82
                Originally posted by Kuciwalker View Post
                Do we really have to play the "BlackCat defends some dumb comment he made long past the point that it's obvious to everyone else that he's wrong" game again?
                It only struck me recently how often he does this.
                12-17-10 Mohamed Bouazizi NEVER FORGET
                Stadtluft Macht Frei
                Killing it is the new killing it
                Ultima Ratio Regum

                Comment


                • #83
                  Originally posted by Asher View Post
                  If LinkedList is a simple shim over an array, I'd personally strangle James Gosling next time I see him.


                  My favourite algorithms interview questions all involve linked lists...
                  12-17-10 Mohamed Bouazizi NEVER FORGET
                  Stadtluft Macht Frei
                  Killing it is the new killing it
                  Ultima Ratio Regum

                  Comment


                  • #84
                    I know, that's why I said it would be something that I'd learn over a couple years or more while I work. In other words, it's a hobby and it's interesting to me because of the complexity of it. As far as Java goes, it's a requirement for my degree, nothing more. More than likely it's because Sun Systems sponsors the school. Either way, it's something I have to do. I'd much rather be learning a different language. Getting a job comes first though since as you said, I won't be writing exploits as a penetration tester or IT security guy at a company. Same with network defense. My job is to use the exploits other people write. Still, to me it's interesting.

                    As far as the what do you use it for question, I'm aware of what you use it for given your job. I was more interested in the others since I don't know what their jobs are.

                    Comment


                    • #85
                      Originally posted by Wiglaf View Post
                      Self deprecation gets you nowhere in life. Do you think self defecation is how I get women/jobs/anything? Everyone wants a confident man
                      Wiglaf is a wise man. Self-promotion is the way to go.
                      12-17-10 Mohamed Bouazizi NEVER FORGET
                      Stadtluft Macht Frei
                      Killing it is the new killing it
                      Ultima Ratio Regum

                      Comment


                      • #86
                        I learned...

                        C first, then IDL, then FORTRAN, then C++ and then Slang

                        IDL and Slang are interpreted languages, and Slang is proprietary. Slang is basically C syntax and IDL is FORTRAN syntax

                        I don't know if the shell *nix scripting languages count, but they'd be somewhere in there if they did.

                        I think I've only recently started to be a really good coder.
                        12-17-10 Mohamed Bouazizi NEVER FORGET
                        Stadtluft Macht Frei
                        Killing it is the new killing it
                        Ultima Ratio Regum

                        Comment


                        • #87
                          I take it you do a lot of coding these days, then?
                          "The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
                          Ben Kenobi: "That means I'm doing something right. "

                          Comment


                          • #88
                            50/50 (about what I was doing during my PhD)

                            but this is the first time that other people use my code
                            12-17-10 Mohamed Bouazizi NEVER FORGET
                            Stadtluft Macht Frei
                            Killing it is the new killing it
                            Ultima Ratio Regum

                            Comment


                            • #89
                              Asher Knows
                              Jon Miller: MikeH speaks the truth
                              Jon Miller: MikeH is a shockingly revolting dolt and a masturbatory urine-reeking sideshow freak whose word is as valuable as an aging cow paddy.
                              We've got both kinds

                              Comment


                              • #90
                                That was in reference to the previous page, but I guess it applies based on this page too.
                                Jon Miller: MikeH speaks the truth
                                Jon Miller: MikeH is a shockingly revolting dolt and a masturbatory urine-reeking sideshow freak whose word is as valuable as an aging cow paddy.
                                We've got both kinds

                                Comment

                                Working...
                                X