0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

C2011(1) 3.14 memory location

Last updated at Posted at 2018-09-22

C2011 3.14 memory location

https://researchmap.jp/jo7bhb629-1797580/#_1797580

original:

c2011-3-14-ex.c
// 1 filename:c2011-3-14-ex.
//ver 0.1 December.29, 2013
//ver0.2 January 11, 2014 add 2 sets of input for clarify about warning and assignment.
//
// 2 original examples and/or notes:
// (c) ISO/IEC JTC1 SC22 WG14 N1570, April 12, 2011
// http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
// C2011 3.14 memory location
//
// 3 compile and output mechanism:
// (c) Ogawa Kiyoshi, kaizen@gifu-u.ac.jp, December.29, 2013
//
// 4 compile errors and/or wornings:
// 4.1(c) Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn)
// Target: x86_64-apple-darwin11.4.2 //Thread model: posix
//Xcode 5.0.2/LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn)
//Command/Options: cc -std=c11 -Wall misra-C-2-1-ex-ui-wicm4a.c 
// (c) LLVM 2003-2009 University of Illinois at Urbana-Champaign.
// 4.2. gcc-4.9 (GCC) 4.9.0 20131229 (experimental) C90/C99/C2011, 32/64 bit, http://gcc.gnu.org/onlinedocs/gcc/Standards.html
//      Copyright (C) 2013 Free Software Foundation, Inc. http://gcc.gnu.org/gcc-4.9/changes.html
//Command/Options: gcc std=c11 -Wall misra-C-2-1-ex-ui-wicm4a.c 
//Configuration:brew install gcc49
//
// 4.3. Visual Studio Express 2013, 
//(c) Microsoft http://www.visualstudio.com/
//SPEC:'most of C99/C11 that is a subset of ISO C++98/C++11'.
//http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2089423-c99-support
//Windows 7, .NET Framework
//(c) VMware, Inc.
//VMWare fusion 6
//
// 4.4 M3T-NC30WA V.5.45 Release 01
//(c) Renesas Electronics Corporation.http://www.renesas.com/products/mpumcu/m16c/
//using M16C M8C simulator, M8C36
//SPEC:C90, 16 bit
//
// 5. Hardware:  MacBook Pro, 
//(c) Intel http://ark.intel.com/products/37006/
//Core 2 Duo 2.53GHz, 8GB, 1067MHz DDR3
//
// 6. Special Thanks: Upper organizatios and 
//ISO/IEC JTC1 SC22 WG14, http://www.open-std.org/jtc1/sc22/wg14/www/standards
//ITSCJ/IPSJ http://www.itscj.ipsj.or.jp/itscj_english/index.html
//Daido Universcity, http://www.daido-it.ac.jp/gakubugakka/computer/index.html
//IT planning Inc., http://www.itpl.co.jp/en/index.html
//Spancion Inc., http://www.spansion.com/
//SWEST: Summer Workshop on Embedded System Technologies , http://swest.toppers.jp
//CEST: Consortium for Embedded System Technology, http://www.ertl.jp/CEST/
//OSC:Open Source Conference, http://www.ospn.jp/

#include "stdafx.h"
//either an object of scalar type, or a maximal sequence of adjacent bit-fields all having
//nonzero width
struct {
char a;
int b:5, c:11, :0, d:8;
struct { int ee:8; } e;
}f;
#ifdef _WIN32
int _tmain(int argc, _TCHAR* argv[]){
#else 
int main(void){
#endif
 f.a = 1;
f.b=2;
f.c=3;
f.d=4;
f.e.ee=5;
printf(" %d %d %d %d %d\n", f.a,f.b,f.c,f.d,f.e.ee);
f.a = 1000001;
f.b = 2000002;
f.c = 3000003;
f.d = 4000004;
f.e.ee=5000005;
printf(" %d %d %d %d %d\n", f.a,f.b,f.c,f.d,f.e.ee);
f.a = 1000000000001;
f.b = 2000000000002;
f.c = 3000000000003;
f.d = 4000000000004;
f.e.ee=5000000000005;
printf("3.14 memory location %d %d %d %d %d\n", f.a,f.b,f.c,f.d,f.e.ee);
}
// no error, no warning 
// output may be
// 3.14 memory location 1 2 3 4 5
// after add two sets of inputs. 10 warnings and output are
// 1 2 3 4 5
// 65 2 -317 4 69
//3.14 memory location 1 2 3 4 5
//
// 65 2 1731 4 69
// 1 2 3 4 5
c:\c2011-3-4-ex.cpp(80): warning C4305: '=' : 'int' から 'char' へ切り詰めます。
c:\c2011-3-4-ex.cpp(80): warning C4309: '=' : 定数値が切り捨てられました。
c:\c2011-3-4-ex.cpp(92): warning C4305: '=' : '__int64' から 'char' へ切り詰めます。
c:\c2011-3-4-ex.cpp(92): warning C4309: '=' : 定数値が切り捨てられました。
c:\c2011-3-4-ex.cpp(94): warning C4305: '=' : '__int64' から 'int' へ切り詰めます。
c:\c2011-3-4-ex.cpp(94): warning C4309: '=' : 定数値が切り捨てられました。
c:\c2011-3-4-ex.cpp(96): warning C4305: '=' : '__int64' から 'int' へ切り詰めます。
c:c2011-3-4-ex.cpp(96): warning C4309: '=' : 定数値が切り捨てられました。
c:\c2011-3-4-ex.cpp(98): warning C4305: '=' : '__int64' から 'int' へ切り詰めます。
c:\c2011-3-4-ex.cpp(98): warning C4309: '=' : 定数値が切り捨てられました。
c:\\c2011-3-4-ex.cpp(100): warning C4305: '=' : '__int64' から 'int' へ切り詰めます。
c:\\c2011-3-4-ex.cpp(100): warning C4309: '=' : 定数値が切り捨てられました。

<この稿は書きかけです。順次追記しています。>

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?