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 9245491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:16:43+00:00 2026-06-18T09:16:43+00:00

If i declare my variables under .data they are considered as global variables, how

  • 0

If i declare my variables under .data they are considered as global variables, how can i declare them locally

@paul I am able to allocate memory but how can i type cast them(such as signed and unsigned int)

  • 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-18T09:16:44+00:00Added an answer on June 18, 2026 at 9:16 am

    Declaration of local variables in assembly code depends on your assembler and it may not support such declarations at all.

    Typically, local variables are allocated by moving (decrementing) the stack pointer. Allocation and initialization of a local variable on the stack can be fused together if you use the push instruction, which advances the stack pointer and writes to the stack. Example of this:

    ; input: eax = some integer >= 1
    ; output: eax = factorial of the integer
    ; used registers: ebx, eflags
    factorial:
    cmp   eax, 1
    je    factorial_end
    push  eax ; created a local variable on the stack
    dec   eax
    call  factorial
    pop   ebx ; destroyed a local variable on the stack
    mul   ebx
    factorial_end:
    ret
    

    As for signed, unsigned and casting, there’s no such thing in assembly. CPUs do exactly what you tell them to. They don’t interpret inputs or outputs, it’s you, the programmer to make that interpretation. And so, if you want to divide two integers as unsigned, you execute DIV with the values of the integers and if you want to make a signed division, you do the same with the IDIV instruction. If you use IDIV on what you think is usigned integers (or DIV on signed integers), the CPU will happily do that for you and the wrong result (or a division overflow exception) will be your problem to deal with. Luckily, addition, subtraction and multiplication of unsigned and 2’s complement signed integers is done in the same way by the CPU for both kinds of integers and you don’t need to do anything special like choosing the right instruction for each kind. Typically, only division and comparison differ between signed and unsigned integers. But again, you take care of this difference explicitly in the code.

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

Sidebar

Related Questions

I can declare private static member variables in a class, but what does it
I usually like to declare my local variables as final but I see repeating
I want to declare some global variables and global constants. Normally, I would put
Possible Duplicate: Global Variables in Cocoa/Objective-C? problem with declare a global variable in objective
In the SQL Server, I can define local variables like this. declare @id number
MSDN categorizes var under Types . variables that are declared at method scope can
I gather that in Objective-C I must declare instance variables as part of the
Is the quality of a language where it's not required to declare a variables
I want to declare some application level variables. These variables changes with values on
I have objects with many variables that I declare and explain in the comments.

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.