Arm Community
Site
Search
User
Site
Search
User
Groups
Arm Research
DesignStart
Education Hub
Graphics and Gaming
High Performance Computing
Innovation
Multimedia
Open Source Software and Platforms
Physical
Processors
Security
System
Software Tools
TrustZone for Armv8-M
中文社区
Blog
Announcements
Artificial Intelligence
Automotive
Healthcare
HPC
Infrastructure
Innovation
Internet of Things
Machine Learning
Mobile
Smart Homes
Wearables
Forums
All developer forums
IP Product forums
Tool & Software forums
Pelion IoT Platform
Support
Open a support case
Documentation
Downloads
Training
Arm Approved program
Arm Design Reviews
Community Help
More
Cancel
Developer Community
Tools and Software
Software Tools
Jump...
Cancel
Software Tools
Keil forum
C Problem?
Tools, Software and IDEs blog
Forums
Videos & Files
Help
Jump...
Cancel
New
State
Not Answered
Replies
14 replies
Subscribers
2 subscribers
Views
581 views
Users
0 members are here
Keil C51 Tools
Related
C Problem?
Offline
Jim Leifker
over 19 years ago
unsigned char x=1; x=(x++)<<3;
Using uVision 6.12
Gives answer of 8
It shifts binary 1 left and doesn't increment.
(even when optimization set to level 0)
Using Micorsoft C++ 6.0
Gives answer of 9
It shifts binary 1 left then increments.
I was a little confused with both answers because I was thought that
the increment would happen first because of the ( ) around x++ then
shift left three giving 16 but that's not the case.
This gives me 16 in both Keil and MS.
x=(++x)<<3; works it gives 16
More questions in this forum
By title
By date
By reply count
By view count
By most asked
By votes
By quality
Descending
Ascending
All recent questions
Unread questions
Questions you've participated in
Questions you've asked
Unanswered questions
Answered questions
Questions with suggested answers
Questions with no replies
Answered
UVision5 (Keil ARM) hangs on splash screen with Windows 10
0
402
views
2
replies
Latest
3 days ago
by
Junhong
Answered
Keil µVision V5.32.0.0 extreme lag in editor, high CPU load
0
547
views
3
replies
Latest
3 days ago
by
Alain Messerli
Not Answered
SWDIO No target connected
+1
Keil MDK
16781
views
5
replies
Latest
5 days ago
by
JSCBLOG
Suggested Answer
armcc.exe and temp path with spaces
0
Arm Compiler
223
views
2
replies
Latest
6 days ago
by
Adam Lins
Answered
GSM INTERFACING PROBLEM WITH STM32
0
1304
views
10
replies
Latest
6 days ago
by
Andy Neil
<
>
View all questions in Keil forum