win10
compiler: Microchip xc8
In the header File:
typedef union
{
uint8_t Bytes[4];
uint32_t Word;
}BYTES_TO_WORD;
extern BYTES_TO_WORD MyBytes;
In the 'C' File with the declairation in it
#include "commonheaderfile.h"
BYTES_TO_WORD MyBytes;
in other 'C' files
#include "commonheaderfile.h"
MyBytes.Word=123445677;
上述這樣是正常運作,結果我不小心在other 'C' file也下了BYTES_TO_WORD MyBytes;
編譯還是過,運作也沒問題,奇怪這樣不是重複定義?
BYTES_TO_WORD MyBytes; 不就會給記憶體區塊了嗎?
謝謝