Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/16/10 11:04
Read: times


 
#180168 - Follow conventions
Responding to: ???'s previous message
Praveen Kumar said:
The entire structure declarations in our project are contained in the file common.h (which is included in the common area source module common.c). These structures are defined (using 'extern') in the file extern.h, so that they will be shared among all the modules. This file is included in the 2 banks source modules (Ext0.c and Ext1.c).

consider declarations as definitions, and
defined as declared.

Sorry..wrongly written.

Life is easier if you follow conventions.

Discard your "common.h" file completely.
Use a single "extern.h"

And a "xxxxx.c" for your globals:
#include "extern.h"

MCBQ		  xdata mcbq[MISS_CALL_BUF];
T_SMDR_R	  xdata trunk_report_smdr[K_MAX_PNT];
PBOOK		  xdata pname[100];
EXTN_DATA	  xdata ln[K_MAX_PORTS];
ALARM_TIME	  xdata al[K_MAX_PORTS];
CB		  xdata cb[K_MAX_PORTS];
HQ		  xdata hq[K_MAX_PORTS];
CHQ		  xdata chq[K_MAX_PORTS];
HQ		  xdata tlq[K_MAX_PORTS];
THQ		  xdata thq[K_MAX_PORTS];
PHQ		  xdata phq[K_MAX_PORTS];
RNO		  xdata rno[K_MAX_PORTS];
RRNO		  xdata rrno[K_MAX_PORTS];
TD		  xdata trunk[K_MAX_PNT];
TTD		  xdata ttrunk[K_MAX_PNT];
TDK		  xdata trunkk[K_MAX_PNT];
EG		  xdata tl_group[K_MAX_GROUPS+1];
SMDR_R		  xdata report_smdr[OUT_CALL_BUF];
ISMDR_R		  xdata i_call_report[INC_CALL_BUF];
PL		  xdata line;
GM		  xdata gm[200];
DNWT		  xdata dnwt[7];
T_GROUP		  xdata t_group[2];
PREFIX		  xdata pfx[K_MAX_PNT];
BSP		  xdata bsp[9];

 

In practice, you will use more descriptive filenames than "extern.h". Often you would call it "project.h"

The links posted earlier have good advice for you.

David.

List of 6 messages in thread
TopicAuthorDate
Structure definition in code banking modules 8052            01/01/70 00:00      
   Don't have two typedef for same type            01/01/70 00:00      
   FAQ - declarations & definitions            01/01/70 00:00      
      declaration and definition interchanged            01/01/70 00:00      
         Follow conventions            01/01/70 00:00      
            Coincidental Cohesion            01/01/70 00:00      

Back to Subject List