VC ++中的文字类型(Literals types in VC++)
我知道标准如下:
- 以0开头的积分被解释为八进制。
- 以0x或0X开头的积分被解释为十六进制。
整数文字的类型取决于其值和符号:
- 默认情况下,小数是有符号的,并且具有值适合的最小类型int,long,long long。
- 十六进制和八进制可以是有符号或无符号的,并且具有最小类型的int,unsigned int,long,unsigned long,long long,unsigned long long,其中文字值适合。
- 没有类型为short的文字但这可以通过后缀覆盖。
但是VC ++怎么样?! 它似乎将十进制,八进制和十六进制视为相同,并且小数也允许使用无符号类型。
类似下面的代码:
cout << typeid(4294967295).name() << endl; cout << typeid(4294967296).name() << endl; cout << typeid(0xffffffff).name() << endl; cout << typeid(0x100000000).name() << endl;
得到:
unsigned long __int64 unsigned int __int64
这是预期的,为什么它与标准不同?
I know the standard is as follows:
- Integrals starting with 0 are interpreted as octal.
- Integrals starting with 0x or 0X are interpreted as hexadecimal.
The type of an integer literal depend on its value and notation:
- Decimals are by default signed and has the smallest type of int, long, long long in which the value fits.
- Hexadecimal and octal can be signed or unsigned and have the smallest type of int, unsigned int, long, unsigned long, long long, unsigned long long in which the literal value fits.
- No literals of type short but this can be override by a suffix.
But what about VC++?! It seems to be treating decimal, octal and hexadecimal the same and unsigned types are also allowed for decimals.
something like the following code:
cout << typeid(4294967295).name() << endl; cout << typeid(4294967296).name() << endl; cout << typeid(0xffffffff).name() << endl; cout << typeid(0x100000000).name() << endl;
gives:
unsigned long __int64 unsigned int __int64
Is this expected and why it is different from the standard?
原文:https://stackoverflow.com/questions/19167208
更新时间:2023-09-16 14:09
最满意答案
您可以在命令行中使用mysql。
ssh -C user@newhost "mysql -uUSER -pPASS -e 'create database NEW_DB_NAME;'" && mysqldump --force --log-error=mysql_error.log -uUSER -pPASS OLD_DB_NAME | ssh -C user@remotehost "mysql -uUSER -pPASS NEW_DB_NAME"
You can use mysql in command line.
ssh -C user@newhost "mysql -uUSER -pPASS -e 'create database NEW_DB_NAME;'" && mysqldump --force --log-error=mysql_error.log -uUSER -pPASS OLD_DB_NAME | ssh -C user@remotehost "mysql -uUSER -pPASS NEW_DB_NAME"
相关问答
更多-
有什么数据库专业书籍介绍?[2022-05-19]
mysql -
如何将SQL Azure数据库复制到本地开发服务器?(How do I copy SQL Azure database to my local development server?)[2023-08-27]
有多种方法可以做到这一点: 使用SSIS(SQL Server集成服务) 。 它只在表中导入data 。 列属性,约束,键,索引,存储过程,触发器,安全设置,用户,登录等不会传输。 但是这是非常简单的过程,只需在SQL Server Management Studio中进行向导即可完成。 使用SSIS和DB创建脚本的组合。 这样就可以获得数据和所有缺少不被SSIS传输的元数据。 这也很简单。 首先使用SSIS传输数据(参见下面的说明),然后从SQL Azure数据库创建DB Create脚本,然后在本地数据 ... -
使用PHP for Android Development连接到MySQL数据库(Connecting to MySQL database using PHP for Android Development)[2021-12-21]
try{ InputStream is = entity.getContent(); ... ... } //'is' goes out of scope here! 范围仅限于第一个try-catch块,因此在第二个中不可用。 做: InputStream is = entity.getContent(); // 'is' now accessible in both try-catch HttpEntity entity = response.getEntity(); // ... -
根据我在互联网上的调查,我认为没有有效的方法可以做到这一点。 我也在https://dba.stackexchange.com/questions/51257/what-is-the-most-efficient-way-to-create-new-mysql-database上提出了这个问题。 Guido建议拥有一堆预先生成的数据库似乎是最相关的。 Based on my investigation in the internet, I suppose that there is no efficient ...
-
制作数据库的本地副本(Making a local copy of a database)[2023-05-08]
您可以从上下文菜单中转储模式,如图所示 You can dump your schema from the context menu like on the picture -
将其导出到单个文件( whatever.sql ),然后通过在本地计算机上运行脚本来导入它。 如果使用MySQL Workbench连接到远程服务器,则左侧有“数据导出”链接。 单击它并完成导出过程。 然后连接到本地服务器,单击“数据导入/恢复”,然后选择刚刚保存的文件。 Export it to a single file (whatever.sql), then import it by running the script on your local computer. There's a "Data ...
-
您可以在命令行中使用mysql。 ssh -C user@newhost "mysql -uUSER -pPASS -e 'create database NEW_DB_NAME;'" && mysqldump --force --log-error=mysql_error.log -uUSER -pPASS OLD_DB_NAME | ssh -C user@remotehost "mysql -uUSER -pPASS NEW_DB_NAME" You can use mysql in comma ...
-
Laravel开发:手动创建MySQL数据库时的含义(Laravel development: Implication when creating MySQL database manually)[2023-07-30]
是的,在我看来,你应该去使用migrations 。 迁移提供了一个很好的界面来以版本控制的方式更改数据库结构。 例如,如果将来你必须从mysql迁移到其他数据库系统。 按照当前的方法,您必须根据新系统创建所有数据库结构。 使用迁移时,您只需更新db驱动程序的配置文件。 你完成了。 Yes, In my opinion you should go for using migrations. Migrations provide a great interface to change database str ... -
SHOW TABLES命令将列出沿着表格的视图,但是,它并不区分2。你的脚本甚至不尝试以不同的方式处理视图,因此它处理它们就像它们是表格一样。 使用SHOW FULL TABLES FROM dbname命令(或来自information_schema的查询表和视图),它将包含一个额外的列,以便在表(基本表)和视图(视图)之间启用dinstinguishing。 修改你的php代码,并根据对象的类型(表或视图)发出适当的drop / create命令。 对于视图,不要执行插入和优化命令。 SHOW TABL ...
-
不,您永远不希望开发/测试环境复制到实时数据库。 如果您不小心丢弃了一张桌子,那么您将清除现场网站。 更好地使用像http://www.mysqldiff.org/这样的东西 No, you never want a development/test environment replicating to a live database. If you accidentally dropped a table, you'd wipe out the live site. Better to use somet ...