Assembly is polluting my brain
Assembly is polluting my brain
I have been doing a lot of 6502 assembly programming. Last night I went back to doing some C programming and I needed to comment out some code. I commented it out, compiled, and to my surprise it was still running as before. I then spent a good 20 minutes trying to figure out why commented out code could still possibly run.
It turns out I used a semicolon in the C code for the comment instead of //. Prepending a line in C with a semicolon does not produce a compile error.
Anyone else mix this up?
It turns out I used a semicolon in the C code for the comment instead of //. Prepending a line in C with a semicolon does not produce a compile error.
Anyone else mix this up?
My 6502 Game System: https://hackaday.io/project/9325-dodo-6 ... ame-system
Re: Assembly is polluting my brain
Hee hee. It might be a bit like switching keyboards - sometimes I use a US style keymapping and sometimes a UK one. There's a moment of adjustment as the punctuation comes out wrong, and then the fingers and the brain adust themselves.
- BigDumbDinosaur
- Posts: 9431
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Assembly is polluting my brain
pnoyes wrote:
I have been doing a lot of 6502 assembly programming. Last night I went back to doing some C programming and I needed to comment out some code. I commented it out, compiled, and to my surprise it was still running as before. I then spent a good 20 minutes trying to figure out why commented out code could still possibly run.
It turns out I used a semicolon in the C code for the comment instead of //. Prepending a line in C with a semicolon does not produce a compile error.
Anyone else mix this up?
It turns out I used a semicolon in the C code for the comment instead of //. Prepending a line in C with a semicolon does not produce a compile error.
Anyone else mix this up?
x86? We ain't got no x86. We don't NEED no stinking x86!
- BigDumbDinosaur
- Posts: 9431
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Assembly is polluting my brain
BigEd wrote:
Hee hee. It might be a bit like switching keyboards - sometimes I use a US style keymapping and sometimes a UK one. There's a moment of adjustment as the punctuation comes out wrong, and then the fingers and the brain adust themselves.
Incidentally, it is C that is causing brain pollution, not assembly language.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: Assembly is polluting my brain
BigDumbDinosaur wrote:
pnoyes wrote:
I have been doing a lot of 6502 assembly programming. Last night I went back to doing some C programming and I needed to comment out some code. I commented it out, compiled, and to my surprise it was still running as before. I then spent a good 20 minutes trying to figure out why commented out code could still possibly run.
It turns out I used a semicolon in the C code for the comment instead of //. Prepending a line in C with a semicolon does not produce a compile error.
Anyone else mix this up?
It turns out I used a semicolon in the C code for the comment instead of //. Prepending a line in C with a semicolon does not produce a compile error.
Anyone else mix this up?
Code: Select all
void strcpy(char *d, char *s) {
while (*d++ = *s++)
;
}
Re: Assembly is polluting my brain
pnoyes wrote:
I have been doing a lot of 6502 assembly programming. Last night I went back to doing some C programming and I needed to comment out some code. I commented it out, compiled, and to my surprise it was still running as before. I then spent a good 20 minutes trying to figure out why commented out code could still possibly run.
It turns out I used a semicolon in the C code for the comment instead of //. Prepending a line in C with a semicolon does not produce a compile error.
Anyone else mix this up?
It turns out I used a semicolon in the C code for the comment instead of //. Prepending a line in C with a semicolon does not produce a compile error.
Anyone else mix this up?
Re: Assembly is polluting my brain
(Personally I never liked colour in my editor. I suppose like a lot of things it's a matter of personal preference.)
- GARTHWILSON
- Posts: 8777
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Assembly is polluting my brain
Same here. I don't use or like the color.
+1
Quote:
Incidentally, it is C that is causing brain pollution, not assembly language. 
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: Assembly is polluting my brain
I do no see any advantage of NOT using syntax colouring. Using them avoids very stupid errors like that. I also use it when coding in assembly.
+2 
Quote:
Incidentally, it is C that is causing brain pollution, not assembly language. 
Re: Assembly is polluting my brain
I dislike colours in terminal windows (b/c they always clash with the background I use), but I use colours in the editor. But obviously I use my own setup for the colours, not the default one. For that, it works very well.
As for C.. well, compared to those sqrt-solving Basic programs posted here a while ago, C is light years cleaner!
As for C.. well, compared to those sqrt-solving Basic programs posted here a while ago, C is light years cleaner!
Re: Assembly is polluting my brain
Bregalad wrote:
pnoyes wrote:
I have been doing a lot of 6502 assembly programming. Last night I went back to doing some C programming and I needed to comment out some code. I commented it out, compiled, and to my surprise it was still running as before. I then spent a good 20 minutes trying to figure out why commented out code could still possibly run.
It turns out I used a semicolon in the C code for the comment instead of //. Prepending a line in C with a semicolon does not produce a compile error.
Anyone else mix this up?
It turns out I used a semicolon in the C code for the comment instead of //. Prepending a line in C with a semicolon does not produce a compile error.
Anyone else mix this up?
My 6502 Game System: https://hackaday.io/project/9325-dodo-6 ... ame-system
- BigDumbDinosaur
- Posts: 9431
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Assembly is polluting my brain
rwiker wrote:
BigDumbDinosaur wrote:
pnoyes wrote:
I have been doing a lot of 6502 assembly programming. Last night I went back to doing some C programming and I needed to comment out some code. I commented it out, compiled, and to my surprise it was still running as before. I then spent a good 20 minutes trying to figure out why commented out code could still possibly run.
It turns out I used a semicolon in the C code for the comment instead of //. Prepending a line in C with a semicolon does not produce a compile error.
Anyone else mix this up?
It turns out I used a semicolon in the C code for the comment instead of //. Prepending a line in C with a semicolon does not produce a compile error.
Anyone else mix this up?
Code: Select all
void strcpy(char *d, char *s) {
while (*d++ = *s++)
;
}
Last edited by BigDumbDinosaur on Thu Apr 14, 2016 7:45 pm, edited 1 time in total.
x86? We ain't got no x86. We don't NEED no stinking x86!
- BigDumbDinosaur
- Posts: 9431
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Assembly is polluting my brain
BigEd wrote:
(Personally I never liked colour in my editor. I suppose like a lot of things it's a matter of personal preference.)
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: Assembly is polluting my brain
I like more constant contrast than that - for me, the green looks good but the red is too dark. Of course this is very much in the area of personal preference.
For the C question, C allows null statements, which may help explain why there's no error in mistakenly trying to comment out a block with semicolons.
For the C question, C allows null statements, which may help explain why there's no error in mistakenly trying to comment out a block with semicolons.
- BigDumbDinosaur
- Posts: 9431
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Assembly is polluting my brain
BigEd wrote:
I like more constant contrast than that - for me, the green looks good but the red is too dark. Of course this is very much in the area of personal preference.
x86? We ain't got no x86. We don't NEED no stinking x86!