Is there any limit on nested loop, say, maximun number of nested layers?
Is there any computer now using 64-bit integer as type int?
Is there any limit on nested loop, say, maximun number of nested layers?
Is there any computer now using 64-bit integer as type int?
Last edited by Antigloss; 10-13-2006 at 08:42 AM.
Nope. There is a limmit on the total size of all stack variables, as SKeane said, but there are no limmits on nesting.Originally Posted by Antigloss
It is too clear and so it is hard to see.
A dunce once searched for fire with a lighted lantern.
Had he known what fire was,
He could have cooked his rice much sooner.
Actually, C89 specifies that a compiler must allow at least 8 (I think) levels of nested loops, and I believe it's 256 for C99.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Hmm, I didn't know that. Well, there goes my idea with the 257 nested loops.Originally Posted by dwks
256 nested loops? wow! thats a whopping O(256) running time..
It is not who I am inside but what I do that defines me.
Just found from C99 Standard. I believe it means the Standard guarantees just 63 nest levels of loops.Originally Posted by C99
The standard generally guarantees minimums, not maximums. Folks are free to create better things. Caveat emptor.Originally Posted by Antigloss
http://en.wikipedia.org/wiki/64-bit#..._architecturesOriginally Posted by Antigloss
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
It'll be better should you copy and paste those contents here coz I cannot access wikipedia for some reasons.Originally Posted by Dave_Sinkula
M'kay.Originally Posted by Antigloss64-bit microprocessor architectures (as of 2006) include:
* The DEC Alpha architecture (view Digital Alpha timeline)
* Intel's IA-64 architecture (used in Intel's Itanium CPUs)
* AMD's AMD64 architecture, a 64-bit version of the x86 architecture (used in AMD's Athlon 64, Opteron, Sempron, and Turion 64 CPUs).
o Intel now uses the same instruction set, calling it EM64T.
* SPARC architecture (64-bit as of SPARC V9)
o Sun's UltraSPARC architecture
o Fujitsu's SPARC64 architecture
* IBM's POWER architecture (64-bit as of POWER3 and RS64 variants)
* IBM/Motorola's PowerPC architecture (64-bit PowerPC 620 and PowerPC 970 variants)
* IBM's z/Architecture, used by IBM zSeries and System z9 mainframes, a 64-bit version of the ESA/390 architecture
* MIPS Technologies' MIPS IV, MIPS V, and MIPS64 architectures
* HP's PA-RISC family (64-bit as of PA-RISC 2.0)
Most 64-bit processor architectures can execute code for the 32-bit version of the architecture natively without any performance penalty. This kind of support is commonly called biarch support or more generally multi-arch support.
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
Most 32-bit platforms today also support some form of 64-bit arithmetic; try using the C99 type long long x;
Code:#include <stdio.h> void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){ puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9 /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i] ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][ t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}
Sorry I didn't make my point clear. Let me try to make it clearer.
C basic data type int is commonly 32-bit-long currently. Does any computer/compiler make int 64-bit-long instead of 32-bit-long?
Yes, some newer 64-bit compilers, I think. I can't give you an actual example, but a Linux or Mac compiler for 64-bit processors might use 64-bit ints. I can check a 64-bit Debian Linux box that I have access to -- next time I get on it -- for you if you like.
Why are you wondering? Just curious?
My particular implementation of GCC allows over 3000 levels of indirection, dependent on how much of the stack was taken up by everything else.Folks are free to create better things. Caveat emptor.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
hey, i know this is a noob question but, what the difference between 32-bit compilers and 64-bit ones? please explain in an untechnical manner if you can please.
It is not who I am inside but what I do that defines me.
> — 127 nesting levels of blocks
This of course refers to this within a single block of code.
The actual number of recursive levels for example is only limited by stack space.Code:for ( ... ) { /* 1 */ for ( ... ) { /* 2 */ for ( ... ) { /* 3 */ for ( ... ) { /* 4 */ /* etc etc */ for ( ... ) { /* down to 127 */ } } } } }
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.