Announcement

Collapse
No announcement yet.

Linux 2.6.38-rc6 Kernel Released; Lots Of Small Fixes

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

  • #16
    Originally posted by devsk View Post
    Using macros you can have clean looking code without goto's and without the overhead of functions.
    Macros get inlined directly into the function, though, don't they? Which would balloon the size of the function and hurt performance by blowing up the CPU caches. The GOTO commands would just be a simple JMP instruction.

    Comment


    • #17
      Originally posted by smitty3268 View Post
      Macros get inlined directly into the function, though, don't they? Which would balloon the size of the function and hurt performance by blowing up the CPU caches. The GOTO commands would just be a simple JMP instruction.
      Agreed, but it also depends on what the target goto label does. If its just 'return return_code;', the code is actually smaller with macro because there is no JMP...;-)

      If the goto label is doing error handling and it has to check for 20 different conditions to conditionally free some middle of the pack allocations after a failure, then the loss can be reduced with macros through localization.

      IMO, Judicious use of goto is a VERY good thing! But most of the time, its better to avoid them.

      Comment


      • #18
        Originally posted by devsk View Post
        Agreed, but it also depends on what the target goto label does. If its just 'return return_code;', the code is actually smaller with macro because there is no JMP...;-)

        If the goto label is doing error handling and it has to check for 20 different conditions to conditionally free some middle of the pack allocations after a failure, then the loss can be reduced with macros through localization.

        IMO, Judicious use of goto is a VERY good thing! But most of the time, its better to avoid them.
        True. Personally, I would never use a GOTO statement, but then i don't work on projects like the kernel where every little extra instruction might matter. Actually, I did use one once, but only because i was porting a bunch of old Fortran code into a new application and it was riddled with them. I got rid of most of them, but left a single one behind because it was just easier than trying to refactor the code.

        Comment

        Working...
        X