Reputation: 521
I am making some functions in c which I am going to call from Python via Cython. I am developing these functions in Code:Block using MinGW C++ compiler. But when building them for Python I have to use Visual Microsoft Visual C++ Compiler for Python 2. Then I have met a strang problem. When compiling with Visual C++ compiler I have after a lot of trial and fail found out that all variables have to be decleared before first in each block (if, for, function). Why is so. Are there difference between compilers for c?
Upvotes: 0
Views: 308
Reputation: 92261
MSVC mostly adheres to the original C89 spec. In later revisions of the language this restriction has been lifted.
Upvotes: 1
Reputation: 2627
In C (proper C rather than C++) the variables have to be declared at the beginning of a block.
Upvotes: 0