The GNU Assembler as uses different characters depending on the architecture to specify single-line comments, such as # on x86, ; on 29k, or @ on ARM. Moreover, regardless of platform, C-style comments are also supported (/* */).

Is there a technical reason for different comment styles on different architecture? The multi-line comment suggest no, as it works on any platform - however if there is no technical limitation on the characters that can be used for comments, why design the assembler to require different comment styles on different platforms (for single-line comments)?

  • 5
    I imagine it would be feel rather unnatural for programmers to change already accepted syntax for a popular instruction set architecture. Since assembly broadly has no standard syntax, these characters have been given different (and conflicting) meanings over the years, by the various manufacturers of instruction set architectures (who also published the original ISA & assembly documentation for their architectures). – Erik Eidt Nov 22 '17 at 0:54
  • The GNU assembler seems to use ; for ARM, not @. – Doc Brown Nov 22 '17 at 7:25
  • I'd guess that # was part of the AT&T syntax which the gnu assembler wanted to be compatible with for x86? – CodesInChaos Nov 22 '17 at 10:39
  • @CodesInChaos This seems unlikely, because the as on the PDP-11 used ; for comments (in addition to / at the start of a line). You can see this in the UNIX V7 source code and in the original cc compiler written by dmr. – Ankush Nov 22 '17 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.