Xref: utzoo comp.sys.ibm.pc:30731 alt.msdos.programmer:169 comp.lang.c:19639 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!execu!sequoia!cb From: cb@sequoia.UUCP (Christopher D. Brown) Newsgroups: comp.sys.ibm.pc,alt.msdos.programmer,comp.lang.c Subject: MS C 5.1 bug: global variable definition Summary: Global variable not PUBLIC Keywords: MSC 5.1, MS C Message-ID: <576@sequoia.UUCP> Date: 28 Jun 89 14:36:14 GMT Reply-To: cb@sequoia.UUCP () Distribution: usa Organization: Execucom Systems Corp., Austin, Texas Lines: 21 Use the Microsoft C 5.1 command line CL /AL /Gt0 /Fa /c to generate assembly and object code for both BUG.C and NOBUG.C. Note that only NOBUG produces the public symbol _a_var. Source file BUG.C is as follows: int near a_var; Generated file BUG.ASM includes the following code: _BSS SEGMENT COMM NEAR _a_var: BYTE: 2 _BSS ENDS Source file NOBUG.C is as follows: int near a_var = 0; Generated file NOBUG.ASM includes the following (correct) code: PUBLIC _a_var _DATA SEGMENT _a_var DW 00H _DATA ENDS Christopher D. Brown