MISRA-C diary(C言語日誌)

2019年1月の記事一覧

N2176 C2017 (1) 3.14 memory location p5.c

N2176 C2017 (1) 3.14 memory location p5.c


// 1 filename:p5.c

// ver. 0.1 December.29, 2013

// ver. 0.2 January 11, 2014 add 2 sets of input for clarify about warning and assignment.

// ver. 0.3 August 22 2018, N2176 C2017

// 2 original examples and/or notes:

// (c) ISO/IEC JTC1 SC22 WG14 N2176, October 9,2017

// http://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf

// C2018 3.14 memory location

//

// 3 compile and output mechanism:

// (c) Ogawa Kiyoshi, kaizen@wh.commufa.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);

}


0