apress / beginning-rust-2e Goto Github PK
View Code? Open in Web Editor NEWSource Code for 'Beginning Rust, 2nd Edition' by Carlo Milanesi
License: Other
Source Code for 'Beginning Rust, 2nd Edition' by Carlo Milanesi
License: Other
The book states:
The sequence of characters \n (where n stands for new line) is transformed by the compiler into the character sequence that represents the line terminator for the currently used operating system.
This is not true. I created a very simple program:
fn main() {
println!("abc\ndef");
}
When I run the program on a Linux machine, I got this:
root@u2004:~/rust1# cargo run | od -ta
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
Running `target/debug/rust1`
0000000 a b c nl d e f nl
0000010
root@u2004:~/rust1#
When I run it on Windows (I installed the od.exe utility on Windows), I got this:
c:\rust1>cargo run | od -ta
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target\debug\rust1.exe`
0000000 a b c nl d e f nl
0000010
c:\rust1>
As you can see, the program produced the exactly same result. So "transformed by the compiler into the character sequence that represents the line terminator for the currently used operating system" is not true. As on Windows, the line terminator is \r\n
, not \n
(which is the line terminator on Linux).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.