Only beginners and incompetent devs use this.

Only beginners and incompetent devs use this.

  1. 3 weeks ago
    Anonymous

    [log in to view media]

    >makes outlandish claim
    >does not elaborate
    >1pbtid

    based

    • 3 weeks ago
      Anonymous

      What does 1pbtid stand for?

      • 3 weeks ago
        Anonymous

        [log in to view media]

        >1pbtid
        You seem new. So, can you and I be fwends? Pweeze?

        • 3 weeks ago
          Anonymous

          No way, fag

        • 3 weeks ago
          Anonymous

          hey i like that picture can i borrow it?

      • 3 weeks ago
        Anonymous

        1 post by this id. on boards like LULZ, /int/, and MISC every IP gets a poster id in each thread so people in the thread know who is who while staying anonymous

        when you mouse over the ID it tells you how many posts this ID has in the thread, and often threads like this one, the OP has only made one post (the thread opener)

        • 3 weeks ago
          Anonymous

          Thanks.

        • 3 weeks ago
          Anonymous

          We need this for LULZ. Have wanted it for years. It's so obvious the rust threads are created by one person who keeps bumping his own posts

          • 3 weeks ago
            Anonymous

            If it's obvious then no, you don't need IP trackers, glowie.

        • 3 weeks ago
          Anonymous

          should be site wide, /b/ would shit themselves if they saw how much spam was from one ip

          • 3 weeks ago
            Anonymous

            The draw of /b/ IS that complete anonymity is enforced.
            For EVERY other board on LULZ[nel], I agree with you though.

        • 3 weeks ago
          Anonymous

          It would be a decent heuristic for a shit thread, but
          >newfags think it means "1 post by this IP on the whole board" (i.e. its someone using a VPN to spam threads while ban evading)
          >people just say it <10 posts into the thread before OP even has a reason to post respond to any of the posters

      • 3 weeks ago
        Anonymous

        one penis boner thrusted in deep

        • 3 weeks ago
          Anonymous

          giwtwm

    • 3 weeks ago
      Anonymous

      >outlandish claim
      Not at all

      • 3 weeks ago
        Anonymous

        Open linux kernel, see for loops, see linked lists, shit on every "competent" dev and move along.

  2. 3 weeks ago
    Anonymous

    [log in to view media]

    For a start, it would compile in GCC.

  3. 3 weeks ago
    Anonymous

    int a = 10;
    loop:
    if(a == 0)
    goto breakloop;
    /* ... */
    a --;
    goto loop;
    breakloop: return;

    • 3 weeks ago
      Anonymous

      Enjoy not having any compiler optimization.

  4. 3 weeks ago
    Anonymous

    for is the ultimate based construct. I've recently stopped using while's, as they're simply redundant. Also, it's so awesome when you can solve a whole loop with an empty for body.
    While, really, should be considered harmful, as it's hardly more than a goto. A for on the other hand has a philosophical aspect to it: what is a loop? Initiation, evolution, and conclusion. It really is the recursion of imperative programming

    • 3 weeks ago
      Anonymous

      interesting take. For most cases I would need a while loop I end up just using an empty for loop and a break statement. I've seen some devs even do this:

      #define forever for(;;)

      forever
      {
      // loops forever

      if (breakout_case)
      break;
      }

      • 3 weeks ago
        Anonymous

        >// loops forever
        >doesn't actually loop forever
        dishonest codemaking

        • 3 weeks ago
          Anonymous

          im sorry

        • 3 weeks ago
          Anonymous

          // fixes bug 1
          #define forever for(;;) for(;;)

        • 3 weeks ago
          Anonymous

          he doesnt know about the halting problem
          get him!

          • 3 weeks ago
            Anonymous

            Anon, nothing in his post implied making a computer detect infinite loops. The problem lies with using terminology to suggest that the program unconditionally will loop forever, while introducing logic that could make it not loop forever. It is essentially a while loop, written with the syntax of an infinite loop.

            • 3 weeks ago
              Anonymous

              said anon made a positive statement that has a truth value. Its the halting problem.

      • 3 weeks ago
        Anonymous

        >// loops forever
        >doesn't actually loop forever
        dishonest codemaking

        just call it loop instead like rust

        • 3 weeks ago
          Anonymous

          > needing a keyword for something like this

        • 3 weeks ago
          Anonymous

          Iterators are not loops.
          Iterators process items from collection-like types using a variety of high-level declarative functions, among them conditions (ex: filter, take_while), operations (ex: reverse, step_by), transformations (ex: map, flatten) and conversion (ex: collect, sum).
          They're much more powerful as a concept, more readable and result in less buggy code.

          • 3 weeks ago
            Anonymous

            >They're much more powerful as a concept
            No. They're just an alternate way of expressing the same thing, with neither more nor less power.

            • 3 weeks ago
              Anonymous

              That's not always true. You can't, for example, "return a loop" from a function so it can be further processed somewhere else. Usually what happens is you end up allocating a new array or whatever and return that. The closest would be to return a closure or have a function that takes a closure with which you do your thing. Iterators also allow you to think in terms of a pipelines, where each step is expressed in a declarative way using high-level concepts instead of manually written code. Example:
              arr.iter()
              .skip(arr.length() / 2)
              .rev()
              .step_by(2)
              .take_while(|x| x > 64)
              .sum();

              This skips over half the array, reverses it, processes every second item while the item is > 64 and finally adds them together. It's super explicit in what it does and it's barely even code. Yes, this example you can replace with a 3 lines for loop, but it won't express the intent as clearly. That would have to be derived from how you set up the loop and what the body does, whereas with iterators you get a simple pipeline of conditions (take_while), operations (rev, skip, step_by) and transformations (sum). That's why it's more powerful (in the sense of expressiveness).

              • 3 weeks ago
                Anonymous

                >You can't, for example, "return a loop" from a function so it can be further processed somewhere else.
                But you're not returning a loop. The loop is in the terminal stage (collect, sum, whatever). Everything before that is just about constructing a generator/stream.

              • 3 weeks ago
                Anonymous

                Remove the sum at the end and that chain of calls will return an iterator. Which can be returned from a function back to the caller, who then might do whatever else on top, including using it in a for loop. That wasn't really the point I wanted to illustrate, but it's as easy as this:
                fn test() -> impl Iterator {
                let arr = &[0, 2, 4, 8, 16, 32, 64, 128, 256, 512];
                return arr.iter()
                .skip(arr.len() / 2)
                .rev()
                .step_by(2)
                .take_while(|x| **x > 64)
                }

              • 3 weeks ago
                Anonymous

                >Iterators also allow you to think in terms of a pipelines
                Rust iterators don't allow you to separate the pipeline from the source though. It's more like a stream than a pipeline.
                On the other hand:
                void do_needful(auto needful) {
                for (auto x : iota(-5, 5) | needful) {
                cout << x << ',';
                }
                cout << 'n';
                }

                int main() {
                do_needful(transform(square) | filter(less_than_2)); // 1,0,1
                do_needful(filter(less_than_2) | transform(square)); // 25,16,9,4,1,0,1
                }

              • 3 weeks ago
                Anonymous

                >Rust iterators don't allow you to separate the pipeline from the source though
                What do you mean? That's just different syntax for the same thing. If you return an iterator like in

                Remove the sum at the end and that chain of calls will return an iterator. Which can be returned from a function back to the caller, who then might do whatever else on top, including using it in a for loop. That wasn't really the point I wanted to illustrate, but it's as easy as this:
                fn test() -> impl Iterator {
                let arr = &[0, 2, 4, 8, 16, 32, 64, 128, 256, 512];
                return arr.iter()
                .skip(arr.len() / 2)
                .rev()
                .step_by(2)
                .take_while(|x| **x > 64)
                }

                you can do whatever you want on top.
                Example:
                fn test() -> impl Iterator<Item = u32> {
                let arr = &[0, 2, 4, 8, 16, 32, 64, 128, 256, 512];
                return arr.iter()
                .skip(arr.len() / 2)
                .rev()
                .step_by(2)
                .take_while(|x| **x > 64)
                .cloned()
                }

                fn square(iter: impl Iterator<Item = u32>) -> impl Iterator<Item = u32> {
                iter.map(|x| x*x)
                }

                fn filter_less_than(iter: impl Iterator<Item = u32>, n: u32) -> impl Iterator {
                iter.filter(|x| x < n)
                }

                fn callit() {
                let iter = test();
                let squared = square(iter);
                let filtered = filter_less_than(squared, 2);
                }
                I hard-coded the type for brevity, I could have used a generic, but then the type constraints would distract from the gist of it. Rust doesn't really do cross-function type inference.

              • 3 weeks ago
                Anonymous

                You can pass around an iterator, but you can't pass around a pipeline that only contains operations.

              • 3 weeks ago
                Anonymous

                You can, but it requires boxing and dynamic dispatch if you want to pass fully generic pipelines (with respect to the iterator, not the type) around:
                type Iter = Box<dyn Iterator<Item = u32>>;

                fn op(iter: Iter) -> Iter {
                Box::new(iter.map(|x| x * x)
                .filter(|x| *x < 2))
                }

                fn pipe() -> Box<dyn Fn(Iter) -> Iter> {
                Box::new(|iter| op(iter))
                }

                fn usepipe() {
                let arr: [u32; 3] = [1, 2, 3];
                let pipe = pipe();
                pipe(Box::new(arr.iter().cloned(*~~;
                }

                I'm not sure how it works in C++. do_needful doesn't even return anything which seems weird.

              • 2 weeks ago
                Anonymous

                >arr.iter()
                > .skip(arr.length() / 2)
                > .rev()
                > .step_by(2)
                > .take_while(|x| x > 64)
                > .sum();
                not what I was referring to
                https://doc.rust-lang.org/reference/expressions/loop-expr.html#infinite-loops
                It's equivalent to an iterator expression like this
                for () in iter::repeat(()) {
                // something
                }

                sure, but are rust infinite loop actually implemented that way? probably not.

              • 2 weeks ago
                Anonymous

                Rust iterators have a repeat method.
                [0, 1, 2].iter().repeat().for_each(|x| println!("{}", x);

                Dhis will run forever.

          • 3 weeks ago
            Anonymous

            Rust literally has a "loop" keyword, moron

            • 2 weeks ago
              Anonymous

              And "loop" does not use iterators, what's your point? Of course Rust has loops. You can even turn iterators into for loops. Doesn't mern they're theksrme thing.

      • 3 weeks ago
        Anonymous

        start:
        if (!breakout_case)
        goto start;

    • 3 weeks ago
      Anonymous

      holy cnile cope
      use a real language if you want high-level iteration

      • 3 weeks ago
        Anonymous

        you're aware that C++ implements container-based iteration, right?

        • 3 weeks ago
          Anonymous

          of course he isn't. his brain has oxidized

    • 3 weeks ago
      Anonymous

      That's because it is a while loop, dressed up in a Monty Python Ministry of Silly Walks style.

      It should have a mandatory "while" keyword in it:

      for (int i=0; while i<10; i++) {
      }

      and then get rid of the "for" keyword which does nothing and means nothing relevant in English and is some math in-joke wink reference like "let" is.

      • 3 weeks ago
        Anonymous

        you should consider crying about it stupid homosexual

      • 3 weeks ago
        Anonymous

        c is reponsible for all the worlds problems
        c programmers (ponytails) and C
        all of the worlds problems. all of them, have been caused by C programmers.

    • 3 weeks ago
      Anonymous

      That's because the C for loop consists of both the pre and postcondition, and keeps them all in the same spot. If you're doing imperative programmimg this is how your control flow should be done

  5. 3 weeks ago
    Anonymous

    i get what you're saying but the rare problem exists where only a for loop can produce your solution

    dont ask me to provide an example because i cant think of one

    • 3 weeks ago
      Anonymous

      >You're wrong but I can't tell you why

    • 3 weeks ago
      Anonymous

      You're wrong.

    • 3 weeks ago
      Anonymous

      A for loop is syntactical sugar for a while loop with a counter variable.
      You can do everything a for loop can in a while loop (not saying you should).

      • 2 weeks ago
        Anonymous

        You literally only need if (not even else) and goto.

        If you use any other construct, you're a terrible programmer.

        • 2 weeks ago
          Anonymous

          Writing goto in any professional context will get you fired lol.

          • 2 weeks ago
            Anonymous

            Complete myth that only nocoders believe.

            goto is quite common in large C codebases since it's the most straightforward method to ensure that resources are released.

  6. 3 weeks ago
    Anonymous

    Real java chads use streams.
    Thanks for your attention sirs.

  7. 3 weeks ago
    Anonymous

    true but it really comes down to a matter of effort. Do you want to put in the time to manually keep track of a bunch of counters and increments or do you just want to let the compiler do it for you...of course there are cases where speed concerns or size constraints come into play

  8. 3 weeks ago
    Anonymous

    >Only beginners and incompetent devs use this.
    Only beginners and incompetent devs use C and languages with C-like syntax? Yes.

  9. 3 weeks ago
    Anonymous

    Imagine being filtered by syntax.

  10. 3 weeks ago
    Anonymous

    Yes, competent devs use LOOP.

  11. 3 weeks ago
    Anonymous

    >doesn't consume namespace with variables declared in it
    >ensures you don't forget iteration step
    >functionally the same as while
    There is no reason not to like the for loop. Should it be used for everything? No but that doesn't mean it doesn't have it uses.

  12. 3 weeks ago
    Anonymous

    reminder
    if you're post 30 and are browsing LULZ for hints/tips/buzzwords to impress ppl. and are looking again to mebbe start to learn programming cos ur crap sales type job is finished or too hard or you've finally realised you'll never get real money

    you'll never be able to do it ever. you are finished. it is too late.

  13. 3 weeks ago
    Anonymous

    >shittiest bait ever to be seen
    >30+ replies

    • 3 weeks ago
      Anonymous

      Not an argument.

  14. 3 weeks ago
    Anonymous

    variables now considered harmful.

  15. 3 weeks ago
    Anonymous

    what's wrong with for loops? i use literally nothing else in my C code. not out of rebellion, but I just don't need other loops as often as for

    • 3 weeks ago
      Anonymous

      >what's wrong with for loops?
      Some people are filtered by them. Some people have a room temperature IQ.

  16. 3 weeks ago
    Anonymous

    global _start

    section .data
    n: db "n-word", 10, 0
    i: equ $-n

    section .text
    _start:
    MOV RDI, 1
    MOV RSI, n
    MOV RDX, i
    MOV RAX, 1
    n-word:
    SYSCALL
    MOV RAX, 1
    JMP n-word

    • 3 weeks ago
      Anonymous

      Did arm64 asm, not familiar with pcasm

      Does SYSCALL call whatever’s in RDX? I’m assuming this prints n-word forever, but I can’t really tell what magic allows it to print to STDOUT

      • 3 weeks ago
        Anonymous

        >but I can’t really tell what magic allows it to print to STDOUT
        RSI is the address of a print, RDX is the length of the string, RAX or RDI is the print syscall and the other is a format specifier. what syscall is being called is implementation defined

        • 3 weeks ago
          Anonymous

          >address of a print
          address of a string, sorry, my ligma is acting up

      • 3 weeks ago
        Anonymous

        >I can’t really tell what magic allows it to print to STDOUT
        It's the write() system call, which is what lies underneath all sorts of print() calls in the standard library. That takes a file descriptor number as its first argument (probably in RDI), and 1 is the standard file descriptor number for stdout.

      • 2 weeks ago
        Anonymous

        SYSCALL just calls kernel functions like write in this case. AX contains the number of the function, DI contains the file descriptor (as this calls write, see man 2 write), SI contains the buffer from where it writes to the file descriptor provided, DX contains the count of bytes to write. Linux returns a value in AX which is why it has to be set to 1 (to write again) afterwards. If you are interested you can read about the AMD64 architecture from AMD's or Intel's programmer's manuals, here is a link to AMD's programmer's manuals because Intel's are always a pain in the ass to find. https://developer.amd.com/resources/developer-guides-manuals/

  17. 3 weeks ago
    Anonymous

    Why not use stream sir?

  18. 3 weeks ago
    Anonymous

    For loops are harder than while loops
    You have to think ahead of time how much you want it to loop before you've written the innards. With while you just set an end condition

  19. 3 weeks ago
    Anonymous

    i HATE curly brackets with a passion.

    • 2 weeks ago
      Anonymous

      you need to leave LULZ and go back to mcdonalds.

    • 2 weeks ago
      Anonymous

      They are annoying especially when the opening is on its own line. Click auto format and make people seeth.

  20. 3 weeks ago
    Anonymous

    goto

  21. 3 weeks ago
    Anonymous

    [log in to view media]

    kek

    >not using the superior

    std::for_each()

    >along with the gigachad lambda

    [] () { }

    • 2 weeks ago
      Anonymous

      that's the most stupid use for for_each

  22. 3 weeks ago
    Anonymous

    >today on "/g/tarded neet makes retard claim thus explaining why you're all jobless basement-dwellers"...

  23. 3 weeks ago
    Anonymous

    So whats the competent senior dev alternative?

    >inb4 recursion
    >inb4 list comprehensions or some other language specific construct which is essentially just syntactic sugar for the Nyulund nightmare

    • 3 weeks ago
      Anonymous

      Iterators

  24. 2 weeks ago
    Anonymous

    This bait worked better than I expected, kudos.

  25. 2 weeks ago
    Anonymous

    Damn right that's a noop at best

  26. 2 weeks ago
    Anonymous

    You rarely need a naked loop

  27. 2 weeks ago
    Anonymous

    I use recursion instead.

    • 2 weeks ago
      Anonymous

      [log in to view media]

      Even more disgusting. Use while like a normal person.

  28. 2 weeks ago
    Anonymous

    You think that's for not f-or, don't you. I bet you don't know what the f stands for.

Your email address will not be published.