Changeset d2e6f84
- Timestamp:
- Sep 15, 2025, 9:22:48 PM (5 days ago)
- Branches:
- master
- Children:
- 96aca388
- Parents:
- 4b465445
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/user/user.tex
r4b465445 rd2e6f84 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Mon Sep 15 17:06:25202514 %% Update Count : 72 1613 %% Last Modified On : Mon Sep 15 21:14:57 2025 14 %% Update Count : 7220 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 2441 2441 The maximum storage for a \CFA ©string© value is ©size_t© characters, which is $2^{32}$ or $2^{64}$ respectively. 2442 2442 A \CFA string manages its length separately from the string, so there is no null (©'\0'©) terminating value at the end of a string value. 2443 Hence, a \CFA string cannot be passed to a C string manipulation routine, such as ©strcat©.2443 Hence, a \CFA string cannot be passed to a C string manipulation function, such as ©strcat©. 2444 2444 Like C strings, characters in a ©string© are numbered from the left starting at 0 (because subscripting is zero-origin), and in \CFA numbered from the right starting at -1. 2445 2445 \begin{cquote} … … 2626 2626 cs - cs2; §\C{// find pointer offset}\CRT§ 2627 2627 \end{cfa} 2628 addition is less obvious :2628 addition is less obvious 2629 2629 \begin{cfa} 2630 2630 ch + 'b' §\C[2in]{// add character values}§ … … 2675 2675 s = 'x' * 3; 2676 2676 s = "abc" * 3; 2677 s = ("P eter" + ' ') * 3;2677 s = ("PETER" + ' ') * 3; 2678 2678 \end{cfa} 2679 2679 & … … 2682 2682 "xxx" 2683 2683 "abcabcabc" 2684 "P eter Peter Peter"2684 "PETER PETER PETER " 2685 2685 \end{cfa} 2686 2686 \end{tabular} … … 2953 2953 \begin{figure} 2954 2954 \begin{cquote} 2955 \setlength{\tabcolsep}{15pt}2956 2955 \begin{tabular}{@{}l|l@{}} 2957 2956 \multicolumn{1}{c}{\textbf{\CC}} & \multicolumn{1}{c}{\textbf{\CFA}} \\ … … 2999 2998 Hence, it is possible to convert a block of C string operations to \CFA strings just by changing the type @char *@ to @string@. 3000 2999 \begin{cquote} 3001 \setlength{\tabcolsep}{15pt}3002 3000 \begin{tabular}{@{}ll@{}} 3003 3001 \begin{cfa} … … 3028 3026 A comparison with \CC string I/O is presented as a counterpoint to \CFA string I/O. 3029 3027 3030 The \CC o output ©<<© and input ©>>© operators are defined on type ©string©.3028 The \CC output ©<<© and input ©>>© operators are defined on type ©string©. 3031 3029 \CC output for ©char©, ©char *©, and ©string© are similar. 3032 3030 The \CC manipulators are ©setw©, and its associated width controls ©left©, ©right© and ©setfill©. 3033 3031 \begin{cquote} 3034 \setlength{\tabcolsep}{15pt}3035 3032 \begin{tabular}{@{}l|l@{}} 3036 3033 \begin{C++} … … 3050 3047 The \CFA manipulators are ©bin©, ©oct©, ©hex©, ©wd©, and its associated width control and ©left©. 3051 3048 \begin{cquote} 3052 \setlength{\tabcolsep}{15pt}3053 3049 \begin{tabular}{@{}l|l@{}} 3054 3050 \begin{cfa} … … 3079 3075 Reading into a ©char© is safe as the size is 1, ©char *© is unsafe without using ©setw© to constraint the length (which includes ©'\0'©), ©string© is safe as its grows dynamically as characters are read. 3080 3076 \begin{cquote} 3081 \setlength{\tabcolsep}{15pt}3082 3077 \begin{tabular}{@{}l|l@{}} 3083 3078 \begin{C++}
Note:
See TracChangeset
for help on using the changeset viewer.