News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Why Is This A Problem?

Started by Twister, September 27, 2010, 10:47:09 PM

Previous topic - Next topic

Twister

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

jj2007

The limit is 255 chars. Use tabs instead of spaces.

oex

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....
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

hutch--

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
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

jj2007

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.

MichaelW

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.

eschew obfuscation

jj2007

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

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

oex

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
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

farklesnots

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!

jj2007

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, destruction of precious registers, etc - thank you! Of late, the Forum has become far too peaceful.

Let's go?
:thumbu


hutch--

Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php