Subj : Re: order of construction To : borland.public.cpp.borlandcpp From : Jeff Kish Date : Wed Jul 30 2003 12:19 pm On Tue, 29 Jul 2003 10:49:03 -0500, " Bruce Salzman" wrote: > >"Jeff Kish" wrote in message >news:sh2divs3m76i7ab37gnk88pgib082rhinr@4ax.com... >> In 5.0.2, is this true? >> >> The "initialization order of global variables in a translation unit is >> already defined as to happen in the order of declaration." >> > >Hi, Jeff > >It appears so. The code below produces: > >v1=1, v2=2, v3=3, v4=4.000000, v5=5.000000 > > >#include "stdio.h" >#include "conio.h" > >char v1 = 1; >short v2 = v1+1; >long v3 = v2+1; >float v4 = v3+1; >double v5 = v4+1; > >int main() >{ > printf("v1=%d, v2=%d, v3=%d, v4=%f, v5=%f\n", v1, v2, v3, v4, v5); > while (!getch()); > return 0; >} > >Regards, >Bruce > Thanks Bruce Jeff Kish .