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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:44:53+00:00 2026-05-30T21:44:53+00:00

char a; char b; char c; a = b + c; a = (char)((int)b+(int)c);

  • 0
char a;
char b;
char c;

a = b + c;

a = (char)((int)b+(int)c);

In the first line it’s implict conversion from char to int. In the second line it’s explicit. Is there a difference in the binary file generated by compiler?

Please consider this question from embedded systems perspective.

  • 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-30T21:44:55+00:00Added an answer on May 30, 2026 at 9:44 pm

    My reading of the standard suggests that this is left up to the implementation and the optimizer.

    Section 5.1.2.3, part 10:

    EXAMPLE 2 In executing the fragment

    char c1, c2;
    /* ... */
    c1 = c1 + c2;
    

    the ‘‘integer promotions’’ require that the abstract machine promote the value of each variable to int size and then add the two ints and truncate the sum. Provided the addition of two chars can be done without overflow, or with overflow wrapping silently to produce the correct result, the actual execution need only produce the same result, possibly omitting the promotions.

    My understanding is that the standard lets the compiler decide if it is OK to use 8-bit addition, as long as the result is not going to be distinguishable from the addition of ints and converted to chars.

    NOTE Back at my days in the embedded world (mid-nineties), the C compiler that we used for our 8-bit platforms, Whitesmith compiler for 68HC11, produced a “plain” 8-bit addition instruction for adding two chars. The only way to find out for sure what happens in your fujitsu system would be to compile-to-assembly and check for yourself.

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

Sidebar

Related Questions

I'm opening a file, and getting lines from it. The first line should say
I have the following code: struct VRfile{ char sessionID[10]; char file[20]; int first; };
I am reading a line from a file containing the names of people, first
#include<stdio.h> #include<string.h> #include<stdlib.h> int main() { // int char str[40],ch; FILE*fp,*fp1,*fp2; fp=fopen(ide_input,w); fp1=fopen(error_log,w); fp2=fopen(lex_output,w);
I want to open a text file (see below), read the first int in
I have a file, on it's first line is the english alphabet, in a
I'm trying to read the first line of an MP3 file (I edited this
EDIT: void print(const int *v, const int size) { FILE *fpIn; fpIn = fopen(char-array.txt,
I have a text file that contains the following data. The first line is
My code, when compiled, returns the error invalid conversion from ‘char*’ to ‘char’ ,

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.