Integer Emulation

This is a discussion on Integer Emulation within the C++ Programming forums, part of the General Programming Boards category; Why not let the program do its own locking if it needs it ? Numbers are used a lot, and ...

  1. #31
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Why not let the program do its own locking if it needs it? Numbers are used a lot, and opening/closing a lock for every single operation would be pretty expensive.
    Locking as close to the resource as possible is easier and usually safer (less chance of missing something) than locking at a higher level, but it's much more resource intensive.

  2. #32
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,452
    Hence the provided functions for locking/unlocking and a macro to do the dirt work so you don't have to bother writing your own code if you don't need it.
    It could even work as a locking resource if the integer/float is going to be changed during the "update" or whatever it is the code is supposed to be doing.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Page 3 of 3 FirstFirst 123
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. memory issue
    By t014y in forum C Programming
    Replies: 2
    Last Post: 02-20-2009, 11:37 PM
  2. Link List math
    By t014y in forum C Programming
    Replies: 17
    Last Post: 02-20-2009, 05:55 PM
  3. Looking for constructive criticism
    By wd_kendrick in forum C Programming
    Replies: 16
    Last Post: 05-28-2008, 09:42 AM
  4. No Match For Operator+ ???????
    By Paul22000 in forum C++ Programming
    Replies: 24
    Last Post: 05-14-2008, 10:53 AM
  5. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 09:43 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21