Click here to Skip to main content
15,886,137 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
Dave Kreskowiak19-Oct-22 12:23
mveDave Kreskowiak19-Oct-22 12:23 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
Randor 19-Oct-22 15:30
professional Randor 19-Oct-22 15:30 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
Kornfeld Eliyahu Peter19-Oct-22 19:02
professionalKornfeld Eliyahu Peter19-Oct-22 19:02 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
PIEBALDconsult20-Oct-22 3:49
mvePIEBALDconsult20-Oct-22 3:49 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
Kornfeld Eliyahu Peter20-Oct-22 6:53
professionalKornfeld Eliyahu Peter20-Oct-22 6:53 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
PIEBALDconsult20-Oct-22 7:11
mvePIEBALDconsult20-Oct-22 7:11 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
trønderen20-Oct-22 7:39
trønderen20-Oct-22 7:39 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
trønderen20-Oct-22 7:36
trønderen20-Oct-22 7:36 
Kornfeld Eliyahu Peter wrote:
because the way assembly flow works...
No, I see no reason whatsoever why assembly flow works differently from flow in 'structured languages'.

The advantages of while- and for-loops, function definitions, if/else, switch etc. lies not in the source language keywords, but in the structured nature of your solution, which is independent of implementation language. That includes assembler.

In my student days, at a Tech University, some of the "hard engineering" departments stubbornly insisted that Fortran was The Only One Language for true engineers. This included the need for arbitrary GO TO jumps. E.g. indenting loops was meaningless, because a jump might break that loop structure. One of the professors wrote an article in the University newsletter were he fiercely attacked and ridiculed this silly idea of the Pascal programmers of moving code back and forth, right and left. That would only confuse the reader of the code, if code flow diverted from the indentation.

I don't think I have ever programmed a goto in a block structured language; it has never appeared to provide any advantage whatsoever. I am thinking in terms of structured constructs even when programming in assembler.

When I hear people arguing that assembler code "must" do it differently, my instinctive reaction is "So you want to program with GOTOs? What for??" It messes up program structure, makes maintenance more difficult, is error prone ...

I, of course, use both conditional and unconditional when assembler coding. Some people reply: "Exactly! Look at yourself: A jump instruction is the same as a GOTO!" But no; I use the jumps in a structured way, the same way that a Pascal or C compiler would generate them, such as jumping back to the top of the loop for another iteration, jump past the loop when the termination condition is satisfied, or skipping over the if clause when the condition is false, or at the end of the if clause, skip over the else clause. Jumps are frequently required at block starts (opening brace, BEGIN in Pascal) and block ends (closing brace, END in Pascal), but never in the middle of a linear sequence.

Short version: I strongly disagree that assembly program code flow differs from structured high level programming code flow. It is technically possible, as is goto-programming in Pascal or C, but you simply do not program that way,
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
Kornfeld Eliyahu Peter22-Oct-22 22:30
professionalKornfeld Eliyahu Peter22-Oct-22 22:30 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
OriginalGriff19-Oct-22 19:18
mveOriginalGriff19-Oct-22 19:18 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
jsc4220-Oct-22 0:11
professionaljsc4220-Oct-22 0:11 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
OriginalGriff20-Oct-22 2:41
mveOriginalGriff20-Oct-22 2:41 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
trønderen20-Oct-22 7:53
trønderen20-Oct-22 7:53 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
TNCaver20-Oct-22 5:13
TNCaver20-Oct-22 5:13 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
trønderen20-Oct-22 7:56
trønderen20-Oct-22 7:56 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
Wizard of Sleeves19-Oct-22 20:57
Wizard of Sleeves19-Oct-22 20:57 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
den2k8819-Oct-22 21:24
professionalden2k8819-Oct-22 21:24 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
Richard MacCutchan19-Oct-22 21:20
mveRichard MacCutchan19-Oct-22 21:20 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
den2k8819-Oct-22 21:22
professionalden2k8819-Oct-22 21:22 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
  Forogar  20-Oct-22 3:37
professional  Forogar  20-Oct-22 3:37 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
TNCaver20-Oct-22 5:12
TNCaver20-Oct-22 5:12 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
trønderen20-Oct-22 8:28
trønderen20-Oct-22 8:28 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
Gary R. Wheeler20-Oct-22 9:44
Gary R. Wheeler20-Oct-22 9:44 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
TNCaver25-Oct-22 4:06
TNCaver25-Oct-22 4:06 
GeneralRe: Sidetracking from 'Tabs vs. Spaces': Do you indent assembly code? Pin
TNCaver20-Oct-22 5:10
TNCaver20-Oct-22 5:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.