📄 bc.1
字号:
3915(statement1)S4388(is)S4492(executed.)S4937(If)S5042(state-)S2496 V1440(ment2)S1723(is)S1822(present)S2145(and)S2322(the)S2477(value)S2727(of)S2843(the)S2998(expression)S3460(is)S3559(0,)S3666(then)S3871(statement2)S4339(is)S4439(executed.)S4880(\(The)S5104(else)S2616 V1440(clause)S1717(is)S1809(an)S1929(extension.\))S2784 V10 B1080(while)S10 R1335(\()S1394(expression)S1849(\))S1908(statement)S2904 V1440(The)S1627(while)S1881(statement)S(will)157 2297 A2484(execute)S2822(the)S2975(statement)S3391(while)S3645(the)S3798(expression)S4258(is)S(non-zero.)383 4355 A4793(It)S4886(evaluates)S3024 V1440(the)S1590(expression)S2047(before)S(each)185 2332 A2544(execution)S2962(of)S3073(the)S3223(statement.)S3710(Termination)S4234(of)S4344(the)S(loop)178 4493 A4697(is)S4790(caused)S5090(by)S5216(a)S3144 V1440(zero)S1639(expression)S2094(value)S2337(or)S2446(the)S2594(execution)S3010(of)S3119(a)S3189(break)S3438(statement.)S3312 V10 B1080(for)S10 R1234(\()S([expression1])548 1293 A1866(;)S([expression2])548 1919 A2492(;)S([expression3])548 2545 A3118(\))S3177(statement)S3432 V1440(The)S1645(for)S1811(statement)S2245(controls)S2617(repeated)S3008(execution)S3448(of)S3581(the)S3753(statement.)S(Expression1)497 4213 A4759(is)S4875(evaluated)S3552 V1440(before)S1726(the)S(loop.)203 1877 A(Expression2)497 2133 A2658(is)S2753(evaluated)S3166(before)S(each)185 3451 A3663(execution)S4081(of)S4192(the)S4342(statement.)S4805(If)S4900(it)S4983(is)S(non-)184 5077 A3672 V1440(zero,)S1670(the)S1824(statement)S2241(is)S2339(evaluated.)S2806(If)S2905(it)S2992(is)S3090(zero,)S3320(the)S(loop)178 3474 A3683(is)S3781(terminated.)S4293(After)S(each)185 4538 A4754(execution)S5177(of)S3792 V1440(the)S1592(statement,)S(expression3)480 2032 A2541(is)S2637(evaluated)S3052(before)S3338(the)S3489(reevaluation)S4015(of)S(expression2.)505 4127 A4685(If)S(expression1)480 4781 A3912 V1440(or)S(expression3)480 1567 A2090(are)S2257(missing,)S2637(nothing)S2987(is)S3098(evaluated)S3528(at)S3645(the)S3812(point)S4062(they)S4279(would)S4574(be)S4713(evaluated.)S5193(If)S4032 V(expression2)480 1440 A1971(is)S2089(missing,)S2476(it)S2582(is)S2699(the)S2872(same)S3129(as)S(substituting)468 3263 A3781(the)S3954(value)S4222(1)S4322(for)S(expression2.)505 4490 A5070(\(The)S4152 V1440(optional)S1799(expressions)S2298(are)S2452(an)S2577(extension.)S3017(POSIX)S10 B3339(bc)S10 R3471(requires)S3827(all)S3959(three)S4192(expressions.\))S4776(The)S4964(follow-)S4272 V1440(ing)S1593(is)S1685(equivalent)S2129(code)S2344(for)S2487(the)S2635(for)S2778(statement:)S4392 V(expression1;)508 1440 A4512 V1440(while)S(\(expression2\))548 1689 A2262({)S4632 V1515(statement;)S4752 V(expression3;)508 1515 A4872 V1440(})S5040 V10 B1080(break)S10 R1440(This)S1650(statement)S2067(causes)S2361(a)S2437(forced)S2726(exit)S2908(of)S3024(the)S3179(most)S(recent)247 3406 A3685(enclosing)S4102(while)S4358(statement)S4776(or)S4892(for)S5042(state-)S5160 V1440(ment.)S5328 V10 B1080(continue)S5448 V10 R1440(The)S1627(continue)S2003(statement)S2419(\(an)S2578(extension\))S3052(causes)S3345(the)S3498(most)S(recent)247 3723 A4000(enclosing)S4415(for)S4563(statement)S4979(to)S5087(start)S5568 V1440(the)S1588(next)S1786(iteration.)S5736 V10 B1080(halt)S10 R1440(The)S1624(halt)S1802(statement)S2215(\(an)S2371(extension\))S2817(is)S2912(an)S3035(executed)S3421(statement)S3835(that)S4014(causes)S4305(the)S10 B4456(bc)S10 R4585(processor)S4999(to)S5105(quit)S5856 V1440(only)S1662(when)S1924(it)S2024(is)S2135(executed.)S2587(For)S2771(example,)S3181("if)S3328(\(0)S3456(==)S3614(1\))S3742(halt")S(will)157 3977 A4177(not)S4348(cause)S10 B4615(bc)S10 R4759(to)S4880(terminate)S5976 V(because)319 1440 A1784(the)S1932(halt)S2108(is)S2200(not)S2353(executed.)S6144 V10 B1080(return)S10 R1440(Return)S1739(the)S1887(value)S2130(0)S2205(from)S2426(a)S2496(function.)S2906(\(See)S3111(the)S3259(section)S3569(on)S3694(functions.\))S6312 V10 B1080(return)S10 R1386(\()S1445(expression)S1900(\))S6432 V1440(Return)S1739(the)S1887(value)S2130(of)S2239(the)S2387(expression)S2842(from)S3063(a)S3133(function.)S3543(\(See)S3748(the)S3896(section)S4206(on)S4331(functions.\))S6600 V870(P)S872(PS)S930(SE)S988(EU)S1052(UD)S1127(DO)S1202(O)S1318(S)S1320(ST)S1378(TA)S1442(AT)S1517(TE)S1581(EM)S1645(ME)S1736(EN)S1800(NT)S1875(TS)S1939(S)S6720 V1080(These)S1352(statements)S1808(are)S1963(not)S2122(statements)S2579(in)S2689(the)S(traditional)414 2844 A3290(sense.)S3590(They)S3829(are)S3985(not)S4145(executed)S4535(statements.)S5042(Their)S6840 V1080(function)S1440(is)S1532(performed)S1977(at)S2075("compile")S2506(time.)S7008 V10 B1080(limits)S10 R1440(Print)S1661(the)S1809(local)S2030(limits)S2284(enforced)S2662(by)S2787(the)S2935(local)S3156(version)S3477(of)S10 B3586(bc)S10 R3687(.)S3762(This)S3966(is)S4058(an)S4178(extension.)S7176 V10 B1080(quit)S10 R1440(When)S1713(the)S1869(quit)S2058(statement)S2477(is)S2577(read,)S2809(the)S10 B2965(bc)S10 R3099(processor)S3518(is)S3618(terminated,)S4107(regardless)S4549(of)S4667(where)S4948(the)S5105(quit)S7296 V1440(statement)S1851(is)S(found.)259 1943 A2252(For)S2417(example,)S2808("if)S2936(\(0)S3045(==)S3184(1\))S3293(quit")S(will)157 3515 A3697(cause)S10 B3946(bc)S10 R4072(to)S4175(terminate.)S7903 V720(Page)S941(5)S2936(\()S2978(.)S3011(\))S4455(September)S4911(13,)S(1996)200 5061 A8143 VEP%%Page: 6 6BP/slant 0 def/height 0 def480 V10 R720(bc)S823(\()S865(1)S923(\))S2696(Eighth)S(Edition)296 2989 A5024(bc)S5127(\()S5169(1)S5227(\))S960 V10 B1080(warranty)S1080 V10 R1440(Print)S1661(a)S(longer)257 1731 A2013(warranty)S2397(notice.)S2718(This)S2922(is)S3014(an)S3134(extension.)S1248 V870(F)S872(FU)S930(UN)S1005(NC)S1080(CT)S1149(TI)S1213(IO)S1249(ON)S1324(NS)S1399(S)S1368 V1080(Functions)S1517(provide)S1865(a)S(method)301 1951 A2293(of)S2418(de\256ning)S2788(a)S2874(computation)S3418(that)S3611(can)S3793(be)S3930(executed)S4330(later.)S4602(Functions)S5040(in)S10 B5160(bc)S1488 V10 R1080(always)S1388(compute)S1762(a)S1835(value)S2081(and)S2254(return)S2523(it)S2607(to)S2713(the)S2864(caller.)S3167(Function)S(de\256nitions)424 3552 A4004(are)S("dynamic")428 4155 A4610(in)S4715(the)S4865(sense)S5110(that)S1608 V1080(a)S1156(function)S1522(is)S(unde\256ned)396 1620 A(until)184 2047 A2262(a)S(de\256nition)385 2338 A2754(is)S(encountered)492 2852 A3375(in)S3484(the)S(input.)231 3638 A3925(That)S(de\256nition)385 4141 A4557(is)S4656(then)S4861(used)S(until)184 5077 A1728 V1080(another)S(de\256nition)385 1422 A1846(function)S2220(for)S2377(the)S2539(same)S2785(name)S3042(is)S(encountered.)517 3148 A3729(The)S3925(new)S(de\256nition)385 4132 A4556(then)S(replaces)331 4768 A5138(the)S1848 V1080(older)S(de\256nition.)410 1312 A1772(A)S1870(function)S2230(is)S2322(de\256ned)S2643(as)S2752(follows:)S1968 V10 B1440(de\256ne)S10 I1723(name)S10 B1966(\()S10 I2025(parameters)S10 B2508(\))S2567({)S10 I2632(newline)S2088 V1540(auto_list)S1966(statement_list)S10 B2550(})S2208 V10 R1080(A)S1178(function)S1538(call)S1709(is)S1801(just)S1971(an)S2091(expression)S2546(of)S2655(the)S2803(form)S3024(")S10 I3065(name)S10 B3283(\()S10 I3317(parameters)S10 B3775(\))S10 R3809(".)S2376 V1080(Parameters)S1562(are)S1719(numbers)S2098(or)S2216(arrays)S2497(\(an)S2660(extension\).)S3163(In)S3281(the)S3438(function)S(de\256nition,)410 3807 A4251(zero)S4459(or)S4577(more)S4818(parameters)S2496 V1080(are)S1238(de\256ned)S1568(by)S1702(listing)S1987(their)S2205(names)S2495(separated)S2909(by)S3042(commas.)S3460(Numbers)S3862(are)S4019(only)S4230(call)S4409(by)S4542(value)S4793(parameters.)S2616 V1080(Arrays)S1400(are)S1569(only)S1792(call)S1983(by)S2128(variable.)S2548(Arrays)S2869(are)S3039(speci\256ed)S3443(in)S3567(the)S3736(parameter)S(de\256nition)385 4186 A4617(by)S4763(the)S4932(notation)S2736 V1080(")S10 I1121(name)S10 B1339([])S10 R1407(".)S1564(In)S1689(the)S1853(function)S2229(call,)S2441(actual)S2723(parameters)S3207(are)S3372(full)S3553(expressions)S4063(for)S4222(number)S4570(parameters.)S5104(The)S2856 V1080(same)S1312(notation)S1666(is)S1758(used)S1967(for)S2110(passing)S2436(arrays)S2708(as)S2817(for)S2960(de\256ning)S3314(array)S3547(parameters.)S4065(The)S4247(named)S4540(array)S4774(is)S4867(passed)S5161(by)S2976 V1080(variable)S1449(to)S1571(the)S1737(function.)S2165(Since)S2432(function)S(de\256nitions)424 2810 A3277(are)S(dynamic,)371 3444 A3858(parameter)S4305(numbers)S4694(and)S4882(types)S5137(are)S3096 V1080(checked)S1441(when)S1690(a)S1766(function)S2132(is)S2230(called.)S2552(Any)S2756(mismatch)S3178(in)S3287(number)S3625(or)S3740(types)S3983(of)S4098(parameters)S(will)157 4572 A4760(cause)S5016(a)S5093(run-)S3216 V1080(time)S1284(error.)S1556(A)S1654(runtime)S1992(error)S(will)157 2214 A2396(also)S2583(occur)S2832(for)S2975(the)S3123(call)S3294(to)S3397(an)S(unde\256ned)396 3517 A3938(function.)S3384 V1080(The)S10 I1275(auto_list)S10 R1664(is)S1769(an)S1903(optional)S2271(list)S2433(of)S2556(variables)S2959(that)S3149(are)S3312(for)S3469("local")S3786(use.)S4009(The)S4205(syntax)S4506(of)S4629(the)S4791(auto)S5003(list)S5165(\(if)S3504 V1080(present\))S1434(is)S1530(")S10 B1571(auto)S10 I1790(name)S10 R2008(,)S(...)75 2061 A2164(;".)S2311(\(The)S2530(semicolon)S2971(is)S3066(optional.\))S3507(Each)S10 I3737(name)S10 R3983(is)S4078(the)S4229(name)S4475(of)S4587(an)S4710(auto)S4911(variable.)S3624 V1080(Arrays)S1385(may)S1588(be)S1713(speci\256ed)S2101(by)S2231(using)S2478(the)S2631(same)S2868(notation)S3227(as)S3341(used)S3555(in)S3664(parameters.)S4188(These)S4460(variables)S4855(have)S5076(their)S3744 V1080(values)S1372(pushed)S1691(onto)S1904(a)S1984(stack)S2226(at)S2334(the)S2492(start)S2701(of)S2820(the)S2978(function.)S3398(The)S3590(variables)S3989(are)S4148(then)S(initialized)403 4356 A4794(to)S4907(zero)S5116(and)S3864 V1080(used)S(throughout)440 1294 A1764(the)S1917(execution)S2338(of)S2452(the)S2605(function.)S3020(At)S3151(function)S3516(exit,)S3722(these)S3960(variables)S4355(are)S(popped)295 4510 A4836(so)S4956(that)S5138(the)S3984 V1080(original)S1434(value)S1692(\(at)S1839(the)S2002(time)S2221(of)S2345(the)S2508(function)S2883(call\))S3103(of)S3227(these)S3474(variables)S3878(are)S4042(restored.)S4457(The)S4654(parameters)S5137(are)S4104 V1080(really)S1337(auto)S1537(variables)S1928(that)S2106(are)S(initialized)403 2257 A2688(to)S2794(a)S2867(value)S3113(provided)S3498(in)S3604(the)S3755(function)S4118(call.)S4342(Auto)S4571(variables)S4963(are)S5115(dif-)S4224 V1080(ferent)S1344(than)S(traditional)414 1545 A1987(local)S2211(variables)S2603(in)S2709(the)S2860(fact)S3040(that)S3219(if)S3309(function)S3672(A)S3773(calls)S3986(function)S4349(B,)S4469(B)S4563(may)S(access)258 4763 A5048(func-)S4344 V1080(tion)S1266(A's)S1442(auto)S1645(variables)S2039(by)S2169(just)S2344(using)S2591(the)S2744(same)S2981(name,)S3254(unless)S3535(function)S3901(B)S3999(has)S4164(called)S4436(them)S4668(auto)S4872(variables.)S4464 V1080(Due)S1278(to)S1386(the)S1539(fact)S1721(that)S1901(auto)S2103(variables)S2496(and)S2670(parameters)S3142(are)S3295(pushed)S3608(onto)S3815(a)S3889(stack,)S10 B4150(bc)S10 R(supports)340 4280 A4649(recursive)S5048(func-)S4584 V1080(tions.)S4752 V1080(The)S1271(function)S(body)200 1640 A1874(is)S1975(a)S2054(list)S2212(of)S10 B2331(bc)S10 R2467(statements.)S2977(Again,)S3283(statements)S3743(are)S3902(separated)S4318(by)S4453(semicolons)S4940(or)S5059(new-)S4872 V1080(lines.)S1353(Return)S1660(statements)S2118(cause)S2375(the)S2531(termination)S3028(of)S3144(a)S3221(function)S3588(and)S3765(the)S3920(return)S4193(of)S4309(a)S4386(value.)S4686(There)S4954(are)S5110(two)S4992 V1080(versions)S1442(of)S1553(the)S1703(return)S1971(statement.)S2434(The)S2618(\256rst)S2802(form,)S3050(")S10 B3091(return)S10 R3372(",)S3465(returns)S3772(the)S3923(value)S4169(0)S4247(to)S4353(the)S(calling)274 4504 A4806(expression.)S5112 V1080(The)S(second)279 1268 A1577(form,)S1828(")S10 B1869(return)S2180(\()S10 I2244(expression)S10 B2704(\))S10 R2738(",)S2834(computes)S3249(the)S3402(value)S3650(of)S3764(the)S3917(expression)S4377(and)S4552(returns)S4862(that)S5043(value)S5232 V1080(to)S1186(the)S(calling)274 1337 A1639(expression.)S2148(There)S2413(is)S2509(an)S
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -