- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
嗨,我在这个简单的代码中收到了这个奇怪的警告,这让我完全困惑了。我在页面中搜索,发现这是一个警告,提醒用户避免使用字符作为矩阵索引,因为它们可以签名,但显然情况并非如此。
这是代码:
#include <stdio.h>
#include <ctype.h>
int main() {
char c='t';
if (isspace(c)==0)
printf ("%c is not a space",c);
return (EXIT_SUCCESS);
}
我的问题是警告的原因是什么?这与 isspace
需要 int 作为参数有关吗?
最佳答案
a warning to alert users to avoid using chars as index of matrix because they can be signned, but obviously this is not the case
实际上是这样的……你看到的并不是编译器看到的。
is it related with the fact that isspace expects an int as argument?
是的; isspace 是一个宏(在您的编译器实现中)访问数组...查看您的 ctype.h 或要求您的编译器扩展宏(例如 gcc -E),您将看到数组访问。
要避免警告,请使用
if (!isspace((unsigned char)c))
关于c - 不使用数组时会显示数组下标类型为 'char' 的警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24749112/
是否可以创建一个可以使用显式参数标签调用的下标? struct MyType { subscript (label: Bool) -> String? { return nil
我正在尝试制作一个包含带有上标和/或下标的文本的超链接。我找到了两种方法来做到这一点,它们都很糟糕。 解决方案#1:使用 Typography.Variants .这为某些字体提供了极好的上标……。
在这里! 我想在 geom_bracket 中包含一个带下标的标签在 ggplot2 .我尝试了不同的方式,但没有人成功(评论中的尝试): library(ggplot2) ggplot(data =
我正在尝试让 graphviz 启动并工作,我迫切需要节点标签中的下标。不幸的是,通过浏览无数关于类似问题的帖子,我似乎适合所有建议的解决方案,但仍然不起作用。这是我的代码: digraph G{
抱歉格式问题,我从来没有真正在这样的论坛上发帖,所以我必须学习一下操作方法。 我的问题是:我正在编写一个模板类,我想通过多种 [] 运算符访问我的容器。我读了一些关于这个主题的内容,所以我已经能够重载
我知道我们可以像在 matplotlib 中生成单个下标 $r_i$ 会给我一个下标为“i”的r。 但我想生成一个包含 3 或 4 个字母的下标,例如 r_ijk 应该给我一个带有“ijk”作为下标的
this[5] 有什么作用?我是否调用了某种未定义的行为?关于: std::vector foo{this, this + 5u}; 这个有用吗?我想知道指针算法对 this 的影响是什么。这是一个测
我从 visual studio 得到了一些奇怪的行为,关于以下代码片段,错误列表显示了 E0349 的几个实例:没有运算符“[]”匹配这些操作数。 Intellisense 似乎暗示类型不匹配,但正
我想为我的数组类提供 PHP 样式的 push_back 功能: arrayT arr; arr[] = 10; // == std::vector::push_back() 和 arrayT::op
下标 (subscripts)可以定义在类(class)、结构体(structure)和枚举(enumeration)中,是访问集合(collection),列表(list)或序列(sequence)
我正在使用traindata训练svm。 (R中的e1071软件包)。以下是有关我的数据的信息。 > str(train) 'data.frame': 891 obs. of 10 variab
#include int main(){ int arr[7] = {0,1,2,3,4,3,2}; arr[0]++[arr]++[arr]++[arr]++[arr]++[arr]
如果我想以特定用户的身份调用主脚本文件中的另一个 shell 脚本,我该怎么做呢?子脚本似乎失去了它正在运行的用户的上下文,我还没有找到任何有用的子脚本技术。 例如:war-install.sh if
这个问题在这里已经有了答案: Why isn't there an operator[] for a std::list? (4 个答案) 关闭 5 年前。 我有这些类型定义: typedef pa
我在 NSUserdefaults 中获取字典的字符串时遇到问题,这是我的代码。我不知道似乎是什么问题: static func getItemInUserDefaultsDictionary(key
我正在尝试执行以下代码并收到错误 Could not find member 'subscript on Xcode6 var b:[[Float]] = [[1,2]] var i2 = 0 //
我尝试运行的代码: std::string genBlankName(std::vector &posts) { std::string baseName = "New Post ";
1 1 A_{3} 2 2 C_{2} 3 3 ^{5}C_{1} 我有一个这样的输入文件要绘制。第三列是该点上的标签( latex 格式)。我如何在绘图上显示这些标签,就像它们在 latex 编译后
我在这里搜索了一段时间,之前的问题/答案部分回答了我的问题。我正在学习 R,来自 Matlab。正如标题所说,我有一个关于情节注释的问题。在 Matlab 中,绘制包含各种数据格式的注释非常简单,我正
我想将一些化学数据放入表格的列中。但在现有表格中,下标显示为普通字符。其中一些显示为问号。我应该怎么做才能解决它? 当我输入这段代码时 SELECT N'H' + NCHAR(0x2082) + N
我是一名优秀的程序员,十分优秀!