C, 231
Chương trình A
i[]={'','','','','','','',',' ','
','
','','','','','','','','','','','','','','','','','','',' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/','0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?','@','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','[','\\',']','^','_','`','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','{','|','}','~','','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�'};main(){}
Rất nhiều dấu vết ở trên. Đây là hexdump xxd:
00000000: 695b 5d3d 7b27 0127 2c27 0227 2c27 0327 i[]={'.','.','.'
00000010: 2c27 0427 2c27 0527 2c27 0627 2c27 0727 ,'.','.','.','.'
00000020: 2c27 0827 2c27 0927 2c27 0b27 2c27 0c27 ,'.','.','.','.'
00000030: 2c27 0e27 2c27 0f27 2c27 1027 2c27 1127 ,'.','.','.','.'
00000040: 2c27 1227 2c27 1327 2c27 1427 2c27 1527 ,'.','.','.','.'
00000050: 2c27 1627 2c27 1727 2c27 1827 2c27 1927 ,'.','.','.','.'
00000060: 2c27 1a27 2c27 1b27 2c27 1c27 2c27 1d27 ,'.','.','.','.'
00000070: 2c27 1e27 2c27 1f27 2c27 2027 2c27 2127 ,'.','.',' ','!'
00000080: 2c27 2227 2c27 2327 2c27 2427 2c27 2527 ,'"','#','$','%'
00000090: 2c27 2627 2c27 5c27 272c 2728 272c 2729 ,'&','\'','(',')
000000a0: 272c 272a 272c 272b 272c 272c 272c 272d ','*','+',',','-
000000b0: 272c 272e 272c 272f 272c 2730 272c 2731 ','.','/','0','1
000000c0: 272c 2732 272c 2733 272c 2734 272c 2735 ','2','3','4','5
000000d0: 272c 2736 272c 2737 272c 2738 272c 2739 ','6','7','8','9
000000e0: 272c 273a 272c 273b 272c 273c 272c 273d ',':',';','<','=
000000f0: 272c 273e 272c 273f 272c 2740 272c 2741 ','>','?','@','A
00000100: 272c 2742 272c 2743 272c 2744 272c 2745 ','B','C','D','E
00000110: 272c 2746 272c 2747 272c 2748 272c 2749 ','F','G','H','I
00000120: 272c 274a 272c 274b 272c 274c 272c 274d ','J','K','L','M
00000130: 272c 274e 272c 274f 272c 2750 272c 2751 ','N','O','P','Q
00000140: 272c 2752 272c 2753 272c 2754 272c 2755 ','R','S','T','U
00000150: 272c 2756 272c 2757 272c 2758 272c 2759 ','V','W','X','Y
00000160: 272c 275a 272c 275b 272c 275c 5c27 2c27 ','Z','[','\\','
00000170: 5d27 2c27 5e27 2c27 5f27 2c27 6027 2c27 ]','^','_','`','
00000180: 6127 2c27 6227 2c27 6327 2c27 6427 2c27 a','b','c','d','
00000190: 6527 2c27 6627 2c27 6727 2c27 6827 2c27 e','f','g','h','
000001a0: 6927 2c27 6a27 2c27 6b27 2c27 6c27 2c27 i','j','k','l','
000001b0: 6d27 2c27 6e27 2c27 6f27 2c27 7027 2c27 m','n','o','p','
000001c0: 7127 2c27 7227 2c27 7327 2c27 7427 2c27 q','r','s','t','
000001d0: 7527 2c27 7627 2c27 7727 2c27 7827 2c27 u','v','w','x','
000001e0: 7927 2c27 7a27 2c27 7b27 2c27 7c27 2c27 y','z','{','|','
000001f0: 7d27 2c27 7e27 2c27 7f27 2c27 8027 2c27 }','~','.','.','
00000200: 8127 2c27 8227 2c27 8327 2c27 8427 2c27 .','.','.','.','
00000210: 8527 2c27 8627 2c27 8727 2c27 8827 2c27 .','.','.','.','
00000220: 8927 2c27 8a27 2c27 8b27 2c27 8c27 2c27 .','.','.','.','
00000230: 8d27 2c27 8e27 2c27 8f27 2c27 9027 2c27 .','.','.','.','
00000240: 9127 2c27 9227 2c27 9327 2c27 9427 2c27 .','.','.','.','
00000250: 9527 2c27 9627 2c27 9727 2c27 9827 2c27 .','.','.','.','
00000260: 9927 2c27 9a27 2c27 9b27 2c27 9c27 2c27 .','.','.','.','
00000270: 9d27 2c27 9e27 2c27 9f27 2c27 a027 2c27 .','.','.','.','
00000280: a127 2c27 a227 2c27 a327 2c27 a427 2c27 .','.','.','.','
00000290: a527 2c27 a627 2c27 a727 2c27 a827 2c27 .','.','.','.','
000002a0: a927 2c27 aa27 2c27 ab27 2c27 ac27 2c27 .','.','.','.','
000002b0: ad27 2c27 ae27 2c27 af27 2c27 b027 2c27 .','.','.','.','
000002c0: b127 2c27 b227 2c27 b327 2c27 b427 2c27 .','.','.','.','
000002d0: b527 2c27 b627 2c27 b727 2c27 b827 2c27 .','.','.','.','
000002e0: b927 2c27 ba27 2c27 bb27 2c27 bc27 2c27 .','.','.','.','
000002f0: bd27 2c27 be27 2c27 bf27 2c27 c027 2c27 .','.','.','.','
00000300: c127 2c27 c227 2c27 c327 2c27 c427 2c27 .','.','.','.','
00000310: c527 2c27 c627 2c27 c727 2c27 c827 2c27 .','.','.','.','
00000320: c927 2c27 ca27 2c27 cb27 2c27 cc27 2c27 .','.','.','.','
00000330: cd27 2c27 ce27 2c27 cf27 2c27 d027 2c27 .','.','.','.','
00000340: d127 2c27 d227 2c27 d327 2c27 d427 2c27 .','.','.','.','
00000350: d527 2c27 d627 2c27 d727 2c27 d827 2c27 .','.','.','.','
00000360: d927 2c27 da27 2c27 db27 2c27 dc27 2c27 .','.','.','.','
00000370: dd27 2c27 de27 2c27 df27 2c27 e027 2c27 .','.','.','.','
00000380: e127 2c27 e227 2c27 e327 2c27 e427 2c27 .','.','.','.','
00000390: e527 2c27 e627 2c27 e727 2c27 e827 2c27 .','.','.','.','
000003a0: e927 2c27 ea27 2c27 eb27 2c27 ec27 2c27 .','.','.','.','
000003b0: ed27 2c27 ee27 2c27 ef27 2c27 f027 2c27 .','.','.','.','
000003c0: f127 2c27 f227 2c27 f327 2c27 f427 2c27 .','.','.','.','
000003d0: f527 2c27 f627 2c27 f727 2c27 f827 2c27 .','.','.','.','
000003e0: f927 2c27 fa27 2c27 fb27 2c27 fc27 2c27 .','.','.','.','
000003f0: fd27 2c27 fe27 2c27 ff27 7d3b 6d61 696e .','.','.'};main
00000400: 2829 7b7d 0a (){}.
Chương trình B
i[]={1,2,3,4,5,6,7,010,011,013,014,016,017,020,021,022,023,024,025,026,027,030,031,032,033,034,035,036,037,040,041,042,043,044,045,046,047,050,051,052,053,054,055,056,057,060,061,062,063,064,065,066,067,070,071,072,073,074,075,076,077,0100,0101,0102,0103,0104,0105,0106,0107,0110,0111,0112,0113,0114,0115,0116,0117,0120,0121,0122,0123,0124,0125,0126,0127,0130,0131,0132,0133,0134,0135,0136,0137,0140,0141,0142,0143,0144,0145,0146,0147,0150,0151,0152,0153,0154,0155,0156,0157,0160,0161,0162,0163,0164,0165,0166,0167,0170,0171,0172,0173,0174,0175,0176,0177,-0200,-0177,-0176,-0175,-0174,-0173,-0172,-0171,-0170,-0167,-0166,-0165,-0164,-0163,-0162,-0161,-0160,-0157,-0156,-0155,-0154,-0153,-0152,-0151,-0150,-0147,-0146,-0145,-0144,-0143,-0142,-0141,-0140,-0137,-0136,-0135,-0134,-0133,-0132,-0131,-0130,-0127,-0126,-0125,-0124,-0123,-0122,-0121,-0120,-0117,-0116,-0115,-0114,-0113,-0112,-0111,-0110,-0107,-0106,-0105,-0104,-0103,-0102,-0101,-0100,-077,-076,-075,-074,-073,-072,-071,-070,-067,-066,-065,-064,-063,-062,-061,-060,-057,-056,-055,-054,-053,-052,-051,-050,-047,-046,-045,-044,-043,-042,-041,-040,-037,-036,-035,-034,-033,-032,-031,-030,-027,-026,-025,-024,-023,-022,-021,-020,-017,-016,-015,-014,-013,-012,-011,-010,-7,-6,-5,-4,-3,-2,-1};main(){}
Chúng biên dịch chính xác cùng mã đối tượng. GCC nhúng tên tệp vào mã đối tượng, vì vậy bạn sẽ cần đặt các tệp cùng tên (trong các thư mục khác nhau).
Tôi đã lo lắng rằng thực tế là không có tài liệu tham khảo nào i
có thể khiến trình biên dịch tối ưu hóa hoàn toàn biến này, nhưng tôi nghĩ rằng làm cho nó trở thành một đảm bảo toàn cầu rằng nó sẽ có mặt trong đối tượng. Điều này có thể được xác minh bằng cách kiểm tra lắp ráp được tạo ra:
.file "diffchar.c"
.globl i
.data
.align 32
.type i, @object
.size i, 1012
i:
.long 1
.long 2
.long 3
.long 4
.long 5
.long 6
.long 7
.long 8
.long 9
.long 11
.long 12
.long 14
.long 15
.long 16
.long 17
.long 18
.long 19
.long 20
.long 21
.long 22
.long 23
.long 24
.long 25
.long 26
.long 27
.long 28
.long 29
.long 30
.long 31
.long 32
.long 33
.long 34
.long 35
.long 36
.long 37
.long 38
.long 39
.long 40
.long 41
.long 42
.long 43
.long 44
.long 45
.long 46
.long 47
.long 48
.long 49
.long 50
.long 51
.long 52
.long 53
.long 54
.long 55
.long 56
.long 57
.long 58
.long 59
.long 60
.long 61
.long 62
.long 63
.long 64
.long 65
.long 66
.long 67
.long 68
.long 69
.long 70
.long 71
.long 72
.long 73
.long 74
.long 75
.long 76
.long 77
.long 78
.long 79
.long 80
.long 81
.long 82
.long 83
.long 84
.long 85
.long 86
.long 87
.long 88
.long 89
.long 90
.long 91
.long 92
.long 93
.long 94
.long 95
.long 96
.long 97
.long 98
.long 99
.long 100
.long 101
.long 102
.long 103
.long 104
.long 105
.long 106
.long 107
.long 108
.long 109
.long 110
.long 111
.long 112
.long 113
.long 114
.long 115
.long 116
.long 117
.long 118
.long 119
.long 120
.long 121
.long 122
.long 123
.long 124
.long 125
.long 126
.long 127
.long -128
.long -127
.long -126
.long -125
.long -124
.long -123
.long -122
.long -121
.long -120
.long -119
.long -118
.long -117
.long -116
.long -115
.long -114
.long -113
.long -112
.long -111
.long -110
.long -109
.long -108
.long -107
.long -106
.long -105
.long -104
.long -103
.long -102
.long -101
.long -100
.long -99
.long -98
.long -97
.long -96
.long -95
.long -94
.long -93
.long -92
.long -91
.long -90
.long -89
.long -88
.long -87
.long -86
.long -85
.long -84
.long -83
.long -82
.long -81
.long -80
.long -79
.long -78
.long -77
.long -76
.long -75
.long -74
.long -73
.long -72
.long -71
.long -70
.long -69
.long -68
.long -67
.long -66
.long -65
.long -64
.long -63
.long -62
.long -61
.long -60
.long -59
.long -58
.long -57
.long -56
.long -55
.long -54
.long -53
.long -52
.long -51
.long -50
.long -49
.long -48
.long -47
.long -46
.long -45
.long -44
.long -43
.long -42
.long -41
.long -40
.long -39
.long -38
.long -37
.long -36
.long -35
.long -34
.long -33
.long -32
.long -31
.long -30
.long -29
.long -28
.long -27
.long -26
.long -25
.long -24
.long -23
.long -22
.long -21
.long -20
.long -19
.long -18
.long -17
.long -16
.long -15
.long -14
.long -13
.long -12
.long -11
.long -10
.long -9
.long -8
.long -7
.long -6
.long -5
.long -4
.long -3
.long -2
.long -1
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl $0, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609"
.section .note.GNU-stack,"",@progbits
Lưu ý rằng trong chương trình B, (hầu hết) các giá trị char được đưa ra trong bát phân. Chúng cũng có thể được đưa ra dưới dạng thập phân, nhưng bằng cách sử dụng bát phân, chúng ta có được một vài ký tự phụ - 8
và 9
- trong tập khác biệt.
GCC dường như không thích CR, LF và (vì lý do rõ ràng) các ký tự NUL bên trong các trích dẫn đơn ''
.
Hãy thử trực tuyến và điểm số .
abcdefghijqlmnop...
để sử dụng hơn 20 ký tự duy nhất. Điều này có được phép không?