0
참고 : Xcode의 최신 버전과 함께 제공되는 목적 C 컴파일러를 사용하고 있습니다.const____restrict 포인터는 수정할 수 있지만 typdef'd 버전은 수정할 수없는 이유는 무엇입니까?
왜이 법적 것을 그 것이다 :
void verySpecial(const float* __restrict foo, const int size) {
for (int i = 0; i < size; ++i) {
// ... do special things ...
++foo; // <-- Should be illegal to modify const pointer?
}
}
그러나, 나는 타입 정의를 사용하는 경우, 그것은 내가 무엇을해야 생각한다.
typedef float* __restrict RFloatPtr;
void verySpecial(const RFloatPtr foo, const int size) {
for (int i = 0; i < size; ++i) {
// ... do special things ...
++foo; // <-- Now this is a compiler error.
}
}
그래서 typedef'd 경우와 다른 점은 무엇입니까? __restrict에 대한 정보를 읽으면 두뇌가 상처를받습니다.
첫 번째 Apple 's에는 gcc 또는 llvm의 objective-c 컴파일러가 없습니다. –
@AnoopVaidya 허, 뭐라구? –
뭐든간에. 그것은 XCode와 함께 제공되는 컴파일러입니다. 앱 스토어에서 가장 최신 버전의 XCode입니다. –