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

  • Home
  • SEARCH
  • 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 7995637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:28:40+00:00 2026-06-04T14:28:40+00:00

Consider this #define : #define msd_buffer ((volatile char *) MSD_BUFFER_ADDRESS) and this variable definition:

  • 0

Consider this #define:

#define msd_buffer              ((volatile char *) MSD_BUFFER_ADDRESS)

and this variable definition:

volatile char *msd_buffer = MSD_BUFFER_ADDRESS;

Are the two definitions of msd_buffer — as variable and as macro — equivalent?

  • 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-06-04T14:28:42+00:00Added an answer on June 4, 2026 at 2:28 pm

    A #define is a macro. It acts as a direct copy-pasta of what you pass into it. So, msd_buffer is not a variable, it is a cast to a volatile char array.

    Assuming example usage like this:

    msd_buffer[160] = 0xFF;
    

    It would be the same as using it as a variable. However, it doesn’t have all the features of a variable, such as assignment:

    msd_buffer = NEW_BUFFER_ADDRESS; // invalid!
    

    Or address taking:

    my_func(&msd_buffer); // invalid!
    

    If you understand these drawbacks (and perhaps there are more), then you are on your way to using a macro like this.

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

Sidebar

Related Questions

Consider a simple macro: #define ECHO(x) x ECHO(foo(1, 2)) This produces the exact output
Consider this macro: #define MAKE_TEMPLATE(...) template <typename T, __VA_ARGS__ > When used with zero
Consider this unhygienic Scheme macro: (define-macro for (lambda (i i1 i2 . body) (let
Consider this code; #define A 5 #define B 3 int difference = A -
Consider this: #ifndef GUARD_H #define GUARD_H ... #endif GUARD_H rather than: #ifndef GUARD_H #define
Consider this piece of code: struct Trade { float Price; char* time; int shares;
Consider this simple program. The program has two files: File Vehicle.java class Vehicle {
Consider this code: #include <stdio.h> #define N 5 void printMatrix(int (*matrix)[N],int n) { int
Consider this (horrible, terrible, no good, very bad) code structure: #define foo(x) // commented
Consider this little program: #include <stdio.h> int main() { char c = 0xFF; printf(%d\n,

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.