Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: Constructors

2004-09-22 by Karl Olsen

--- In lpc2000@yahoogroups.com, "dave_albert" <david_albert@h...> 
wrote:
> Here's a snippet of code I use to call C++ constructors in crt0.S
> I call it after clearing .bss and initializing .data:
> 
> 
>      /* Call global C++ object constructors */
> 
>      ldr     r4, =__CTOR_LIST__      @ Null terminated list of ctors
> Ctor_Loop:      
>      ldr     r5, [r4], #+4           @ Fetch constructor address
>      cmp     r5, #0                  @ Test for end of list
>      addne   lr, pc, #4              @ Save return address
>      movne   pc, r5                  @ Call constructor
>      bne     Ctor_Loop               @ Continue for all constructors
> 

Won't the called constructor likely modify the zero flag so that 
the "bne Ctor_Loop" might terminate the loop prematurely?

Karl Olsen

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.