2015-01-21 4 views
0
  1. 5.3에서 5.5로 PHP를 마이그레이션 중입니다.
  2. freebsd 7 - gcc에서 교차 컴파일을 수행합니다. 4.2.1
  3. arm, i386 및 powerpc에 대해 컴파일합니다.

원본 파일이 컴파일되지 않습니다. 다음은 실제 코드와 비슷한 코드입니다.비트 필드 변수 명명 규칙 및 유효하지 않은 유형 오류 gcc 4.2.1 freebsd 7

typedef struct _abc { 
     char *d; 
     size_t s; 
     size_t u; 
     uint f:1; 
     uint _arj:31; 
}abc; 

유닛 및 기타 유형은 typedef를 사용하여 상단 헤더 파일에 정의됩니다. 첫 번째 코멘트 다음에이 행을 추가했습니다.

내가 오류 얻을 : 비트 필드 '___arj을'난 그냥 ARJ _arj 이름을 변경하고 일

무효 형을 가지고있다. 아직 코드베이스에서 arj에 _arj를 찾아 교체해야합니다.

비트 필드에서 사용되는 변수의 명명 규칙이 있습니까?

+0

'uint' 표준 유형이 아닌 여기에 glibc는 설명서에서 발췌? –

+0

최상위 헤더에 typedef unsigned int uint로 정의되어 있습니다. 나는 또한 이것으로 내 질문을 업데이 트했습니다. –

+0

'uint'를'unsigned'로 변경하면 작동합니다. 하지만 'uint'가 시스템에 정의되어 있다면 예제 코드는 문제없이 컴파일되어야합니다. – ryyker

답변

0

구현 된 예약 이름에 대해서는 일반적으로 앞에 밑줄이있는 이름을 시작하는 것은 좋지 않습니다. 선행 더블 언더 스코어는 실제로 위반입니다.

In addition to the names documented in this manual, reserved names include all external identifiers (global functions and variables) that begin with an underscore (‘_’) and all identifiers regardless of use that begin with either two underscores or an underscore followed by a capital letter are reserved names. This is so that the library and header files can define functions, variables, and macros for internal purposes without risk of conflict with names in user programs.

내가으로부터받은 페이지로 연결되는 링크 : - 어떻게 정의 http://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html