Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7003025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:00:27+00:00 2026-05-27T21:00:27+00:00

Code: %define x 0x03 x equ 0x03 What’s the difference between them?

  • 0

Code:

%define x 0x03
x equ 0x03

What’s the difference between them?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:00:27+00:00Added an answer on May 27, 2026 at 9:00 pm

    %define is a far more powerful way of doing macros, akin to the C pre-processor. In your simplistic case, there is not a lot of difference, using x in the source code will result in the constant 3 being substituted. There’s a subtle difference in that equ statements are evaluated once, when they are first read and %define macros are evaluated whenever they are encountered in the source.

    You can see the difference there between the two statement snippets:

    addr   equ       $
           %define   addr $
    

    In that case, addr, when encountered in the code, will have different values. In the first case, $ will be the location of the assembly position at the place where the equ is. In other words, where it’s defined.

    In the second case, it evaluates to the assembly location at the place where addr is used.

    Where %define shines is with something like:

    %define thricexplusy(x,y) (3 * x + y)
    

    or:

    %define ctrl(c) (c & 0x1F)
    : :
    mov     al, ctrl('z')
    

    (or even considerably more complex things) which allow you to pass parameters to your macro, something not possible with a simple equ.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

code: #define f(a,b) a##b #define g(a) #a #define h(a) g(a) main() { printf(%s\n,h(f(1,2))); //[case
I have the following C code: #define PRR_SCALE 255 ... uint8_t a = 3;
The following code works fine #define open { #define close } #include<stdio.h> #define int
I sometimes define Business Logic classes to help my ASPX code-behind classes. It makes
I want to define some member variable and some code just in Debug Mode,
I occasionally write code something like this: // file1.cpp #define DO_THIS 1 #if DO_THIS
I have the following code snippet: #ifdef DO_LOG #define log(p) record(p) #else #define log(p)
I need to define new UI Elements as well as data binding in code
I have some Objective-C code that looks like this: #define myVar 10 float f
I have a define: hashdefine kPingServerToSeeIfInternetIsOn http://10.0.0.8 then in code I with to use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.