Use _PB_CreateMapElement when accesing MAP Elements

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
normeus
Enthusiast
Enthusiast
Posts: 414
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Use _PB_CreateMapElement when accesing MAP Elements

Post by normeus »

Currently, "sometimes" This code is generated for accessing map elements:

Code: Select all

  PUSH   dword [m_myMap]
  CALL  _PB_GetMapElement@8
  MOV    ebp,eax
when the info inside the map is requested [like: r$=s$+myMap(x) ] then this code is generated:

Code: Select all

  PUSH   dword [m_myMap]
  CALL  _PB_CreateMapElement@8
  MOV    ebp,eax
Timing difference is minimal if "_PB_CreateMapElement@8" is used to access data inside a map instead of "_PB_GetMapElement@8".
It might break some code but it will give consistency to the way elements are created in a map.

it could fix these errors: see KCC's post:http://www.purebasic.fr/english/viewtop ... 27#p509927

Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari