How come this causes an error in MASM?
error A2039: line too long
invoke CreateWindowEx, 0, \
offset className, \
offset className, \
WS_OVERLAPPEDWINDOW, \
CW_USEDEFAULT, \
CW_USEDEFAULT, \
CW_USEDEFAULT, \
CW_USEDEFAULT, \
0, \
0, \
hInstance, \
0
The limit is 255 chars. Use tabs instead of spaces.
because the single code line is too long for the compiler.... you may be able to fix by putting all on the same line or by using shorter token names....
REPLACE This
invoke CreateWindowEx, 0, \
offset className, \
offset className, \
WS_OVERLAPPEDWINDOW, \
CW_USEDEFAULT, \
CW_USEDEFAULT, \
CW_USEDEFAULT, \
CW_USEDEFAULT, \
0, \
0, \
hInstance, \
0
WITH this
invoke CreateWindowEx, 0,OFFSET className,OFFSET className,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,
0,0,hInstance,0
Quote from: oex on September 27, 2010, 10:53:26 PM
because the single code line is too long for the compiler.... you may be able to fix by putting all on the same line or by using shorter token names....
Nope. The single line is about 80 chars, no problem, but the combined lines were about 600 chars because he uses one of these old-fashioned editors that insert spaces instead of tabs. Remove the spaces, and once you are below a total of 255 chars, it works.
Quote from: jj2007 on September 28, 2010, 12:54:16 AM
The single line is about 80 chars, no problem, but the combined lines were about 600 chars because he uses one of these old-fashioned editors that insert spaces instead of tabs.
It doesn't have to be an old-fashioned editor it can be a modern editor under the control of an old-fashioned programmer :bg
I, for example, never put tabs in source files because I share a lot of my code and tabs in shared code, or worse the typical mixture of tabs and spaces, presents a problem for other people reading/editing it.
Quote from: MichaelW on September 28, 2010, 01:49:27 AM
I, for example, never put tabs in source files...
Michael, I am flabbergasted! Confess that you also use fixed-pitch fonts... :wink
Plain text with no tabs and fixed pitch has one major advantage, it displays correctly in any editor that supports fixed pitch without the endless variable of different tab settings on every editor.
Quote from: jj2007 on September 28, 2010, 12:54:16 AM
Nope. The single line is about 80 chars, no problem, but the combined lines were about 600 chars because he uses one of these old-fashioned editors that insert spaces instead of tabs. Remove the spaces, and once you are below a total of 255 chars, it works.
My original post made more sense but I updated it, removing "replace the tabs with spaces" bit as you had just said this seconds before :bg
The 'code line' was too long with spaces, \ continues the 'code line' to the next line.... I did leave the bit "you may be able to fix by putting all on the same line" :lol.... I wasnt sure whether the limit was 127 or 255 chars though and was too lazy to check :lol
Personally I keep all my code on one line (except db statements).... I want to try and fit my procs in one screen if I can or at least as much functionality as possible in one screen.... There are few functions that use this many arguements so a little scrolling for those that do on a smaller monitor isnt the end of the world....
I use tabs rather than spaces because spaces tend to have more downsides.... ie fixed vs variable display spaces are different sizes and the formating looks crap, Manually maintaining formating for after lines ; comments etc is far more efficient etc
Quote from: jj2007 on September 28, 2010, 06:41:36 AM
Quote from: MichaelW on September 28, 2010, 01:49:27 AM
I, for example, never put tabs in source files...
Michael, I am flabbergasted! Confess that you also use fixed-pitch fonts...
:wink
Total reading failure on my part! When I first read this, I thought it said "fixed pitch-forks" and had a mental image of Medieval peasants storming the castle to demand that the nobles quit using these modern high-level tools like assemblers and mnemonic instructions, but go back to programming the way God originally intended: re-wire the circuits connecting the vacuum tubes!
Quote from: farklesnots on October 01, 2010, 12:02:49 AM... had a mental image of Medieval peasants storming the castle to demand that the nobles quit using these modern high-level tools like assemblers and mnemonic instructions, but go back to programming the way God originally intended: re-wire the circuits connecting the vacuum tubes!
farklesnots,
Your post has all the good ingredients for a little fight over tabs or spaces, killer macros (http://www.masm32.com/board/index.php?topic=14892.msg121307#msg121307), destruction of precious registers (http://www.masm32.com/board/index.php?topic=9650.msg70547#msg70547), etc - thank you! Of late, the Forum has become far too peaceful.
Let's go?
:thumbu
:P