当前位置: 首页 > news >正文

无锡手机网站花都个性设计商城网站建设

无锡手机网站,花都个性设计商城网站建设,微信小程序数据库搭建,wordpress标签id在哪里以语法对照表格形式学习新语言#xff0c;以rust为例。 关于rust的个人看法#xff1a; 能否替代c#xff1f;部分场景可以#xff0c;长远看并不会。如果c再扩一些关键字#xff0c;类似cpp的吸星大法式扩充#xff0c;rust并不具备优势。解决了c的内存管理问题#x…以语法对照表格形式学习新语言以rust为例。 关于rust的个人看法 能否替代c部分场景可以长远看并不会。如果c再扩一些关键字类似cpp的吸星大法式扩充rust并不具备优势。解决了c的内存管理问题部分解决。所有权概念是将c中内存管理模式加了约束并在编译期做了检查。关于语言的生态位个人感觉rust很难替代c的生态位。rust似乎是科研人员对c等语言进行研究后加入了一些新的实际上已有的概念。往往是编程实践中的范式做了语言层面的语法支持。类似openmp扩展。语言本质上逃不脱图灵机的定义在最小实现基础上为了方便、安全、开发效率等加了编程范式的语法支持。c、cpp语言已经做得够好设计哲学也是效率至上安全问题交给开发者负责。rust引入的所有权概念在c、cpp中实际也可以用编程范式(智能指针)实现。AI时代是否会出现最合适AI人合作的语言如果有大概率会在c语言基础上扩展概念和范式。毕竟c的数据基础更好。个人倾向于认为rust有点过设计了。cpp过于复杂也过设计了。个人感觉未来AI更适合使用以c为基础的语言适当扩展一些概念。 crust链接https://www.runoob.com/cprogramming/c-tutorial.htmlhttps://www.runoob.com/rust/rust-tutorial.htmlhttps://www.runoob.com/cplusplus/cpp-tutorial.htmlhttps://kaisery.github.io/trpl-zh-cn/title-page.html标准库stdio.h … https://www.runoob.com/cprogramming/c-standard-library.htmlhttps://doc.rust-lang.org/stable/std/all.html在线工具https://www.runoob.com/try/runcode.php?filenamehelloworldtypechttps://play.rust-lang.org/?versionstablemodedebugedition2021rust编译器依赖于c编译器语言类型面向过程多范式面向对象、函数式和并发编程注释// or /* */// or /* */行结尾;;路径分隔符/ or \::代码块{}{}函数体表达式无{}大小写区分同c标识符以字母 A-Z 或 a-z 或下划线 _ 开始后跟零个或多个字母、下划线和数字0-9。同c关键字https://www.runoob.com/cprogramming/c-basic-syntax.htmlhttps://github.com/rust-lang/book/blob/main/src/appendix-01-keywords.mdkeysauto,break,case,char,const,continue,default,do,double,as,async,await,break,const,continue,crate,dyn,else,enum,extern,else,enum,extern,float,for,goto,if,int,long,register,return,short,false,fn,for,if,impl,in,let,loop,match,mod,move,mut,pub,ref,return,signed,sizeof,static,struct,switch,typedef,unsigned,union,void,volatile,whileSelf,self,static,struct,super,trait,true,type,union,unsafe,use,where,while,c99 keys_Bool,_Complex,_Imaginary,inline,restrictabstract,become,box,do,final,macro,override,priv,try,typeof,unsized,virtual,yield,c11 keys_Alignas,_Alignof,_Atomic,_Generic,_Noreturn,_Static_assert,_Thread_local数据类型char,unsigned char,signed char ,int,unsigned int,short,unsigned short,long,unsigned longi8,u8,i16,u16,i32,u32,i64,u64,i128,u128,isize,usizefloat,double,long doublef32,f64,f128_Boolboolvoid无。空元组 () “unit type”unicode无char(4byte)建议utf8字符串char str[] “RUNOOB”;let str String::from(“RUNOOB”); let string String::new(); let one 1.to_string();字符串切片自行实现let part1 str[0…5];//类似string_view非字符串切片自行实现let part arr[0…3];变量int i0;let i:i32 0;变量声明extern int i;extern { static i: i32;}重影Shadowing无let x 5; let x x 1;左值指向内存位置的表达式同c右值存储在内存中某些地址的数值同c常量long myLong 100000L;float myFloat 3.14f;char myChar ‘a’;char myString[] “Hello, world!”;const MY_LONG: i64 100000; const MY_STRING: str “Hello, world!”; …#define PI 3.14159const PI: f64 3.14159;const int MAX_VALUE 100;const MAX_VALUE:u32 100;存储类型auto,register,static,externstatic,extern所有权无每个值都有一个变量称为其所有者。一次只能有一个所有者。当所有者不在程序运行范围时该值将被删除。生命周期{}代码块内同c静态生命周期staticstatic生命周期注释无描述引用生命周期。声明两个引用的生命周期一致。fn longera(s1: a str, s2: a str) - a str{…}移动Move无let s1 String::from(“hello”);let s2 s1; println!(“{}, world!”, s1); // 错误s1 已经失效克隆Clone无let s1 String::from(“hello”);let s2 s1.clone(); println!(“{}, world!”, s1);算术运算符 -*/% – -*/%关系运算符 ! 同c逻辑运算符 || !同c位运算符 | ^ ~ 同c赋值运算符 - * / % | ^ 同c三元运算符(a 0)? 1:-1if (a 0) { 1 } else { -1 }sizeof运算符sizeof()use std::mem; std::mem::size_of(…)引用和解引用运算符 * *区间运算符无… …运算符优先级https://www.runoob.com/cprogramming/c-operators.html用()改变求值顺序同c判断/条件语句if(…){…}else{…}if(…){…}else{…} 可以不要()仅支持bool判断switch分支判断switch(…){case …:break;case …:break;default:…;}无用match替代if let无用if替代if let 0 i {println!(“zero”);}else{…}循环for(;; ){} while(){} do{}while();while(){} for i in a.iter(){…} loop{… break; …}break,continuebreak,continuegoto无函数定义int max(int x, int y) {…}fn max(x: i32, y: i32)-i32 {…}函数嵌套无fn main() { fn five() - i32 {5}}函数调用int ret max(a, b);let ret: i32 max(a, b);参数作用域全局变量,局部变量,形式参数为局部变量同c。多了借用borrowing和可变借用mutable borrowing概念可变参数… 具体示例见printf实现无数组int i_array[] {1, 2, 3, 4, 5};let mut i_array: [i32; 5] [1, 2, 3, 4, 5];向量无。用数组替代let vector: Vec Vec::new(); let vector vec![1, 2, 4, 8];外加大量的方法。数组下标0同c数组访问i_array[i]i_array[i]多维数组int i_a2[3][3];let mut i_a2: [[i32; 3]; 3] [[0; 3]; 3];动态数组通过指针和malloc实现let mut dynamic_array: Vec i32 Vec::new();map无。自行实现。use std::collections::HashMap;指针int *pNULL;无引用无let s1 String::from(“hello”);let s2 s1;可变引用无let mut s1 String::from(“run”);let s2 mut s1;垂悬引用无编译期识别eg:fn dangle() - String { let s String::from(“hello”); s}地址取地址方式t同c函数指针typedef int (*fun_ptr)(int,int);let func_ptr: fn(i32,i32) - i32;枚举enum DAY{ MON1, TUE, WED, THU, FRI, SAT, SUN};enum Book {Papery, Electronic} enum Book { Papery(u32), Electronic(String),}枚举赋值无enum Book {Papery { index: u32 },Electronic { url: String },} let book Book::Papery{index: 1001};match无类似switchmatch book {Book::Papery { index } { println!(“Papery book {}”, index); }, Book::Electronic { url } { println!(“E-book {}”, url); }}NULLNULL0无Option枚举无替代NULL。enum Option T {Some(T), None,}let opt: Optionstr Option::None;match opt {Option::Some(something) { println!(“{}”, something);}, Option::None { println!(“opt is nothing”); }}结构体struct SIMPLE{ int a; char b; double c;};struct SIMPLE{ a:i32; b:i8; c:f64;}复合类型/元组无let tup: (i32, f64, u8) (500, 6.4, 1);let (x, y, z) tup;元组结构体无struct Color(u8, u8, u8);let black Color(0, 0, 0);单元结构体无struct UnitStruct;//无成员结构体成员访问. 或 -只用. 没有-结构体方法无struct Rectangle { width: u32, height: u32,} impl Rectangle { fn area(self) - u32 {self.width * self.height}}结构体关联函数无impl Rectangle { fn create(width: u32, height: u32) - Rectangle { Rectangle { width, height } }} //impl 可以写多次输出结构体无println!(“rect1 is {:?}”, rect1);//属性较多的话可以使用另一个占位符 {:#?}共用体union Data{ int i; float f; char str[20];};enum Data { Integer(i32), Float(f32), String([char; 20]),}共用体成员访问同结构体match …位域struct bs{ int a:8; int b:2; int c:6;};#[repr©] #[derive(Debug)] struct BitStruct { a: u8, b: u8, c: u8,}位域成员访问同结构体同c别名typedef unsigned char BYTE;type BYTE u8;程序入口int main( int argc, char *argv[] )fn main(){let args std::env::args();println!(“{:?}”, args);}输入int scanf(const char *format, …) 函数从标准输入流 stdin 读取输入stdin().read_line(mut str_buf).expect(“Failed to read line.”);输出int printf(const char *format, …) 函数把输出写入到标准输出流 stdoutprintln!(“Your input line is \n{}”, str_buf);文件读写FILE *fopen( const char *filename, const char *mode ); int fclose( FILE *fp );int fputs( const char *s, FILE *fp );char *fgets( char *buf, int n, FILE *fp );fread(…)fwrite(…)…use std::fs; let text fs::read_to_string(“D:\text.txt”).unwrap(); let mut file fs::File::open(“D:\text.txt”).unwrap(); file.read(mut buffer).unwrap();fs::write(…) …文件打开权限设置const char *modelet mut file OpenOptions::new().read(true).write(true).open(“D:\text.txt”)?;预处理#define #include #undef #ifdef #ifndef #if #else #elif #endif无用宏替代#errorcompile_error!#pragma#[allow()] 和 #[warn()] 等预定义宏__DATE__ __TIME__ __FILE__ __LINE__ __STDC__无。运行时有部分对应。预处理器运算符\ # ##无宏带参数#define square(x) ((x) * (x))macro_rules! square { (KaTeX parse error: Expected }, got EOF at end of input: x:expr) { (x) * ($x) };}头文件#include stdio.h #include “my_head.h”use std::io::stdin;类型转换int i3;double d (double)i;let d: f64 i as f64;错误处理extern int errno ;fprintf(stderr, “错误号: %d\n”, errno); perror(“通过 perror 输出错误”); fprintf(stderr, “错误号对应的描述: %s\n”, strerror( errno ));可恢复错误用 ResultT, E 类来处理对于不可恢复错误使用 panic! 宏来处理。支持回溯。回溯非自带支持。run with RUST_BACKTRACE1 environment variable to display a backtrace.ResultT, E用int自行实现enum ResultT, E { Ok(T), Err(E),} 在 Rust 标准库中可能产生异常的函数的返回值都是 Result 类型的。?符号无? 符仅用于返回值类型为 ResultT, E 的函数unwrap,expect无可恢复错误按不可恢复错误处理除0异常崩溃线程 panic异常崩溃程序退出状态exit(EXIT_SUCCESS); 0为正常状态。EXIT_FAILURE-1process::exit(0);递归一般通过递归函数实现同c内存管理malloc free通过所有权和智能指针如 Box T、Rc T 和 Arc T命令行参数int main( int argc, char *argv[] )fn main()无通过let args: Vec String env::args().collect();获得随机数srand(time(0)) rand()use rand::Rng; rand::rngs::StdRng::seed_from_u64(seed);rng.gen();排序void qsort(void *b, size_t n, size_t s, compar_fn cmp);sort()查找void *bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size, __compar_fn_t __compar);binary_search(t)组织管理.h.c.lib.dll …箱Crate、包Package、模块Module访问权无公共public和私有private默认私有eg: pub mod government { pub fn govern() {} }模块Module无有点像cpp的namespacemod nation {mod government {fn govern() {}} mod congress {fn legislate() {}} mod court {fn judicial() {}}}模块自描述无pub fn message() - String { String::from(“This is the 2nd module.”)}// second_module.rs文件头路径无绝对路径从 crate 关键字开始描述。相对路径从 self 或 super 关键字或一个标识符开始描述。use无use crate::nation::government::govern as nation_govern;泛型函数_Genericfn max T (array: [T]) - T {…}泛型结构无struct Point T {x: T, y: T}特性(trait)无trait Descriptive { fn describe(self) - String;} impl 特性名 for 所实现的类型名 接口(Interface)无。通过一组函数指针实现。trait类似但可以定义默认实现继承无。通过派生类包含基类成员实现同c多态无。通过函数指针实现。通过特性trait实现并发(concurrent)自行解决安全高效的处理并发是 Rust 诞生的目的之一。编译期解决部分问题。并行(parallel)threadopenmp线程(thread)系统库use std::thread;thread::spawn(…);闭包无函数指针|arg1, arg2, …| - T {…}Lambda无函数指针无闭包实现消息无通道channel发送者transmitter接收者receiver。use std::sync::mpsc;let (tx, rx) mpsc::channel();代码例子https://www.runoob.com/cprogramming/c-examples.html
文章转载自:
http://www.morning.khzml.cn.gov.cn.khzml.cn
http://www.morning.jxfsm.cn.gov.cn.jxfsm.cn
http://www.morning.iknty.cn.gov.cn.iknty.cn
http://www.morning.mbfkt.cn.gov.cn.mbfkt.cn
http://www.morning.qrqcr.cn.gov.cn.qrqcr.cn
http://www.morning.vtbtje.cn.gov.cn.vtbtje.cn
http://www.morning.byjwl.cn.gov.cn.byjwl.cn
http://www.morning.mwwnz.cn.gov.cn.mwwnz.cn
http://www.morning.fhkr.cn.gov.cn.fhkr.cn
http://www.morning.xkhhy.cn.gov.cn.xkhhy.cn
http://www.morning.pzss.cn.gov.cn.pzss.cn
http://www.morning.qhnmj.cn.gov.cn.qhnmj.cn
http://www.morning.plydc.cn.gov.cn.plydc.cn
http://www.morning.krdmn.cn.gov.cn.krdmn.cn
http://www.morning.dyrzm.cn.gov.cn.dyrzm.cn
http://www.morning.beeice.com.gov.cn.beeice.com
http://www.morning.pbzlh.cn.gov.cn.pbzlh.cn
http://www.morning.gpkjx.cn.gov.cn.gpkjx.cn
http://www.morning.fmqng.cn.gov.cn.fmqng.cn
http://www.morning.incmt.com.gov.cn.incmt.com
http://www.morning.fnssm.cn.gov.cn.fnssm.cn
http://www.morning.gpsr.cn.gov.cn.gpsr.cn
http://www.morning.mnpdy.cn.gov.cn.mnpdy.cn
http://www.morning.phnbd.cn.gov.cn.phnbd.cn
http://www.morning.ndynz.cn.gov.cn.ndynz.cn
http://www.morning.xfxnq.cn.gov.cn.xfxnq.cn
http://www.morning.jbgzy.cn.gov.cn.jbgzy.cn
http://www.morning.nxwk.cn.gov.cn.nxwk.cn
http://www.morning.kfysh.com.gov.cn.kfysh.com
http://www.morning.rpfpx.cn.gov.cn.rpfpx.cn
http://www.morning.nfks.cn.gov.cn.nfks.cn
http://www.morning.dhdzz.cn.gov.cn.dhdzz.cn
http://www.morning.ljmbd.cn.gov.cn.ljmbd.cn
http://www.morning.bmqls.cn.gov.cn.bmqls.cn
http://www.morning.ysckr.cn.gov.cn.ysckr.cn
http://www.morning.lmrjn.cn.gov.cn.lmrjn.cn
http://www.morning.xfjwm.cn.gov.cn.xfjwm.cn
http://www.morning.dxhnm.cn.gov.cn.dxhnm.cn
http://www.morning.gnjkn.cn.gov.cn.gnjkn.cn
http://www.morning.zwndt.cn.gov.cn.zwndt.cn
http://www.morning.trzzm.cn.gov.cn.trzzm.cn
http://www.morning.mdgpp.cn.gov.cn.mdgpp.cn
http://www.morning.qwzpd.cn.gov.cn.qwzpd.cn
http://www.morning.yfrbn.cn.gov.cn.yfrbn.cn
http://www.morning.ckfqt.cn.gov.cn.ckfqt.cn
http://www.morning.fqljq.cn.gov.cn.fqljq.cn
http://www.morning.wbxrl.cn.gov.cn.wbxrl.cn
http://www.morning.tnjz.cn.gov.cn.tnjz.cn
http://www.morning.jzgxp.cn.gov.cn.jzgxp.cn
http://www.morning.gnkbf.cn.gov.cn.gnkbf.cn
http://www.morning.cpgdy.cn.gov.cn.cpgdy.cn
http://www.morning.bhgnj.cn.gov.cn.bhgnj.cn
http://www.morning.nqlnd.cn.gov.cn.nqlnd.cn
http://www.morning.pnmgr.cn.gov.cn.pnmgr.cn
http://www.morning.trsfm.cn.gov.cn.trsfm.cn
http://www.morning.qrdkk.cn.gov.cn.qrdkk.cn
http://www.morning.jrlxz.cn.gov.cn.jrlxz.cn
http://www.morning.rykmf.cn.gov.cn.rykmf.cn
http://www.morning.leeong.com.gov.cn.leeong.com
http://www.morning.bmmhs.cn.gov.cn.bmmhs.cn
http://www.morning.nxhjg.cn.gov.cn.nxhjg.cn
http://www.morning.fprll.cn.gov.cn.fprll.cn
http://www.morning.fhjnh.cn.gov.cn.fhjnh.cn
http://www.morning.brzlp.cn.gov.cn.brzlp.cn
http://www.morning.cjcry.cn.gov.cn.cjcry.cn
http://www.morning.xfncq.cn.gov.cn.xfncq.cn
http://www.morning.mgfnt.cn.gov.cn.mgfnt.cn
http://www.morning.qcfcz.cn.gov.cn.qcfcz.cn
http://www.morning.mmjqk.cn.gov.cn.mmjqk.cn
http://www.morning.qqhersx.com.gov.cn.qqhersx.com
http://www.morning.lhrxq.cn.gov.cn.lhrxq.cn
http://www.morning.xfdkh.cn.gov.cn.xfdkh.cn
http://www.morning.jrplk.cn.gov.cn.jrplk.cn
http://www.morning.tqrbl.cn.gov.cn.tqrbl.cn
http://www.morning.spkw.cn.gov.cn.spkw.cn
http://www.morning.kkjlz.cn.gov.cn.kkjlz.cn
http://www.morning.mhnr.cn.gov.cn.mhnr.cn
http://www.morning.xjkfb.cn.gov.cn.xjkfb.cn
http://www.morning.clpkp.cn.gov.cn.clpkp.cn
http://www.morning.xsszn.cn.gov.cn.xsszn.cn
http://www.tj-hxxt.cn/news/251438.html

相关文章:

  • 彩票网站建设需要什么产品推广词
  • tor网站建设电子商务书城网站建设方案
  • 浙江金圣建设有限公司网站网站开发的排期
  • 长春市长春网站建设樟树有哪几个网站做爆药库
  • 网站设计师大学学什么专业熊猫办公ppt模板下载免费
  • 电脑pc端网站建设是什么意思漳州建设企业网站
  • 网站 502错误做网站都需要考虑哪些
  • wordpress移动端投放广告seo博客大全
  • 祁连县公司网站建设网络专业的网站建设价格低
  • 徐州教育平台网站建设服务器安装wordpress
  • wordpress主题 king成都白帽优化
  • php完整电商网站开发源码派多格宠物网站建设
  • 网站运营的作用html页面网站建设中
  • 网站模版开发提供网站建设的理由
  • 电脑网站设计公司网站建设总结报告书
  • 国内外优秀网站设计WordPress总是收到英文评论
  • 南宁电商网站建设最有效的网站推广费用
  • 网站开发易语言哪个做网站公司好
  • 安徽网站seowordpress中文插件seo百度
  • 网上做夫妻的网站logo标志设计网
  • 网站会员系统wordpress网站素材类型
  • 普通网站备案建立网站商店
  • 网站ip流量查询网络用户管理系统注册
  • 网站静态和动态区别是什么意思做一个企业网站设计
  • flash网站什么意思做网站的好处在哪里
  • 电脑可以做服务器部署网站吗用.net做购物网站
  • 商务网站建设与推广实训意义计算机网络专业主要学什么
  • 在ppt里面做网站链接导出wordpress到文本
  • 自己搭建服务器 发布网站 域名如何申请黄骅住房和城乡建设局网站
  • 广州设计企业网站怎么样自己创建网站