Results 1 to 10 of 10

Thread: Ternary operator, begin/end

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    I'm a hobby programer myself. Maybe if all goes well I will become full-time programer in the future. But till then I still have to learn a bit.

  2. #2
    Those overloaded iff functions are not so unreadable at all.

    I think they are great (especially for string concatenation), especially since with later delphi and fpc you can inline them, and not suffer any (correct me) performance penalty for calling a function (stack allocations, etc..)
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  3. #3
    It depends on what you do with the parameters. I mean, the next code:

    Code:
      TheVariable := IFF (Something, TheVariable + 15, TheVariable * 2);
    generates the same executable than:
    Code:
      Tmp1 := TheVariable + 15;
      Tmp2 := TheVariable * 2;
      TheVariable := IFF (Something, Tmp1, Tmp2);
    May be the compiler can optimize it but I doubt FPC or Delphi are so smart even with -O4. In that case C's "?:" would generate faster code.
    No signature provided yet.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •