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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:40:51+00:00 2026-05-22T22:40:51+00:00

I am learning C and assembly language together. I noticed that assembly is a

  • 0

I am learning C and assembly language together. I noticed that assembly is a type-less language compared to the C which requires declaration of the data type before data can be processed. But also I learnt that even a code written in C is first compiled into a code written in assembly and then assembled into object code. So that means data type declaration we use in C or any high level language is only meant for the ease of C compiler. They don’t have any special bearing on the object code. Is that correct?

What I gathered is that type declaration tells compiler what all operations can be done on the data, size of the data (required to store data in data segment), size of the max and min decimal numbers that can be stored. Am I right to say so?

Are there are any other benefits of type declaration?

  • 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-22T22:40:52+00:00Added an answer on May 22, 2026 at 10:40 pm

    In C, we have a simple type system but it’s not particular sophisticated, can be (and frequently is, in practice) circumvented with completely unchecked casts, etc. (For these reasons, C is often called “weakly typed”, which is ill-defined and usually used for bashing a language, but at least tells that types aren’t that important.) The size, layout and alignment of types isn’t fixed, although it will generally be consistent with the same compiler (version) on the same platform. An int may be 14 bits large, etc., these things aren’t guaranteed (except that the C standards requires some ordering between the the basic integral types, e.g. short must not be larger than int).

    The programmer doesn’t know the details, but the compiler does and in fact needs to. For example, the exact code generated for foo.y where struct Foo { int x; short y; }; and struct Foo foo; depends e.g. on the exact sizes of int and short and on the padding of struct Foo, as it compiles down to “take the adress of foo, add the offset of y in struct Foo, and use that”. Even the struct Foo foo; requires exact knowledge of struct Foo (and, recursively, the types it is composed of) – the generated code must know the exact sizeof(struct Foo) to reserve the right number of bytes on the stack? Similarily, type declarations are needed to know which opcodes to use for math (iadd or fadd or addition? Must one of the operands be extended, and to what size?), comparisions, the step size when doing pointer arithmetic (p + n actually adds n * sizeof(*p)), etc. This also prevents access to nonexistent members (and, by extension, passing values to functions which would then run into this problem – i.e. type mismatch), but that’s more like a convenient side effect – the compiler considers it an error because wouldn’t know what code to emit, not because it believes programmers are like children that must be watched and kept in order.

    In assembly language (usually – just yesterday I read about a project at Microsoft Research that develops a typed, verifyable assembly language for an OS that’s safe against certain bugs by construction), you don’t really have types. You have bytes. You take N bytes from some location, do some stuff to them, and store them to some location. Yeah, registers are fixed to some word size and some may be intended for special kinds of values (e.g. dedicated floating point registers with 80 or more bits), but basically, you can store anything you like anywhere. Nobody’s stopping you from storing 8 bytes somewhere, later reading only the latter 4 bytes and adding them with your loop counter to form an adress to store the return value at.

    In other languages, the type system is much stronger while allowing a huge range of extensions that allow higher-level programming, such as abstracting away the exact types (and hence, their layout and typing) and just taking any type that fullfills a certain contract. It allows type signatures such as [a] -> a, which is a function taking a list containing any kind of value (as long as it’s homogenous, e.g. a list of integers, a list of strings, a list of lists of chars, etc.) and returns one of its elements, without “erasing” (e.g. casting to void *) the type. (Depending on the implementation, it may actually generate several implementations, each for a single type with a known layout, for performance – but that doesn’t leak through to the programmer.)

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

Sidebar

Related Questions

I am learning about packing data with assembly language (specifically HLA), which is a
Where could one start learning assembly language from? Could you suggest some place that
I'm learning assembly language. I started with Paul A. Carter's PC Assembly Language which
does anyone have any resources for learning assembly language on x86? I'm trying to
Most people suggest that learning assembly is essential, its important to know the underlying
I'm a beginner learning some assembly, when preserving the ESP register before a function
I am thinking about learning assembly language in order to gain expertise in reverse
I am learning assembly language. Is there modulus operator in assembly? I know I
I just finished learning assembly language. But I couldn't understand what could I implement
Hi I just started learning assembly in IA32. Can anyone tell me what these

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.