另一个列表 [英] Another one for the list
问题描述
在另一个地方看到:
--------
typedef void my_lib_void;
my_lib_void my_lib_func(my_lib_void);
--------
(从应该出现在
< http://yossi.kreinin的内容中总结出来。 hates-software.com/2007/07/10/7a21fc28.html>
最终,虽然因为我写这篇文章而被打破了)
这是完全有效的C;我不知道为什么有人会真的想要这么做,但显然并没有阻止人们。
据报道但是,C ++编译器会阻塞它。
dave
-
Dave Vandervies dj ****** @ csclub.uwaterloo.ca
我想知道加拿大是否可以取消美国在突然袭击? ...... [A]很长
因为装甲车并没有试图在收费公路上使用加拿大硬币,
可能没有来自州的任何阻力或地方当局。 --Kevin,SDM
dj * *****@csclub.uwaterloo.ca (Dave Vandervies)写道:
见到另一个地方:
--------
typedef void my_lib_void;
my_lib_void my_lib_func(my_lib_void);
--------
哇。只比某个图书馆稍微讽刺一点,而且每个标准的C类型都会以相似的名字开始使用g来开始
。
-
char a [] =" \ n .CJacehknorstu" ;; int putchar(int); int main(void){unsigned long b []
= {0x67dffdff,0x9aa9aa6a,0xa77ffda9,0x7da6aa6a,0xa6 7f6aaa,0xaa9aa9f6,0x11f6},* p
= b,i = 24; for(; p + =!* p; * p / = 4)开关(0 [p]& 3)情况0:{return 0; for(p - ; i - ; i - )case +
2:{i ++; if(i )break; else default:continue; if(0)case 1:putchar(a [i& 15]); break;}}}
我试过运行c ++代码
#include< stdio.h>
#include< iostream>
使用命名空间std;
int main()
{
typedef void my_lib_void;
printf(" Hello void%d",sizeof(my_lib_void));
系统(PAUSE);
返回0;
}
它在第二行产生错误main()..
但同时如果c代码
int main()
{
typedef void my_lib_void;
printf(" Hello void%d",sizeof(my_lib_void));
system(" PAUSE");
返回0;
}
它的工作原理显示sizeof(my_lib_void)为1
有谁可以解释原因?
欢呼,
Sumedh
7月10日下午7:39,dj3va ... @ csclub.uwaterloo.ca(Dave Vandervies)
写道:
在另一个地方看到:
--------
typedef void my_lib_void;
my_lib_void my_lib_func(my_lib_void);
--------
(摘自应该出现在
< http://yossi.kreinin.hates-software.com/2007/07/10/7a21fc28.html>
最终,虽然因为我被打破了''这是写的)
这是完全有效的C;我不知道为什么有人会真的想要这么做,但显然并没有阻止人们。
据报道但是,C ++编译器会阻塞它。
dave
-
Dave Vandervies dj3va。 .. @ csclub.uwaterloo.ca
我想知道加拿大是否可以突然袭击美国? ...... [A]很长
因为装甲车并没有试图在收费公路上使用加拿大硬币,
可能没有来自州的任何阻力或地方当局。 --Kevin,SDM
sumedh写道:
我试过跑以下c ++代码
#include< stdio.h>
#include< iostream>
使用命名空间std;
int main()
{
typedef void my_lib_void;
printf(" Hello void%d",sizeof(my_lib_void));
系统(PAUSE);
返回0;
}
它在第二次出错主线()..
但同时如果c代码
int main()
{
typedef void my_lib_void;
printf(" Hello void%d",sizeof(my_lib_void));
system(" PAUSE");
返回0;
}
它的工作原理显示sizeof(my_lib_void)为1
有人可以解释原因吗?
请不要过头。同时将C ++相关问题发布到C ++组
就像comp.lang.c ++。
你的程序都没有意义。试图将
视为不存在类型的大小是什么意思? C ++的规则非常严格,因为
会阻止编译,而在C语言中,它会使用诊断程序进行编译,因此
会产生无意义的结果。
Seen in another place:
--------
typedef void my_lib_void;
my_lib_void my_lib_func(my_lib_void);
--------
(summarized from what should be appearing at
<http://yossi.kreinin.hates-software.com/2007/07/10/7a21fc28.html>
eventually, though it''s broken as I''m writing this)
This is perfectly valid C; I don''t know why anybody would actually WANT
to do it, but that apparently doesn''t stop people.
It''s reported that a C++ compiler will choke on it, though.
dave
--
Dave Vandervies dj******@csclub.uwaterloo.ca
I wonder if Canada could take out the US in a surprise attack? ... [A]s long
as the armored vehicles didn''t try to use Canadian coins on the toll roads,
there might not be any resistance from state or local authorities. --Kevin, SDM
dj******@csclub.uwaterloo.ca (Dave Vandervies) writes:
Seen in another place:
--------
typedef void my_lib_void;
my_lib_void my_lib_func(my_lib_void);
--------Wow. Only slightly more moronic than a certain library that
typedefs each of the standard C types to a similar name beginning
with "g", though.
--
char a[]="\n .CJacehknorstu";int putchar(int);int main(void){unsigned long b[]
={0x67dffdff,0x9aa9aa6a,0xa77ffda9,0x7da6aa6a,0xa6 7f6aaa,0xaa9aa9f6,0x11f6},*p
=b,i=24;for(;p+=!*p;*p/=4)switch(0[p]&3)case 0:{return 0;for(p--;i--;i--)case+
2:{i++;if(i)break;else default:continue;if(0)case 1:putchar(a[i&15]);break;}}}
I tried running following c++ code
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
typedef void my_lib_void;
printf("Hello void %d",sizeof(my_lib_void));
system("PAUSE");
return 0;
}
it gives an error on second line of main()..
but at same time if c code
int main()
{
typedef void my_lib_void;
printf("Hello void %d",sizeof(my_lib_void));
system("PAUSE");
return 0;
}
it works showing sizeof(my_lib_void) as 1
Can anyone explain why?
cheers,
Sumedh
On Jul 10, 7:39 pm, dj3va...@csclub.uwaterloo.ca (Dave Vandervies)
wrote:Seen in another place:
--------
typedef void my_lib_void;
my_lib_void my_lib_func(my_lib_void);
--------
(summarized from what should be appearing at
<http://yossi.kreinin.hates-software.com/2007/07/10/7a21fc28.html>
eventually, though it''s broken as I''m writing this)
This is perfectly valid C; I don''t know why anybody would actually WANT
to do it, but that apparently doesn''t stop people.
It''s reported that a C++ compiler will choke on it, though.
dave
--
Dave Vandervies dj3va...@csclub.uwaterloo.ca
I wonder if Canada could take out the US in a surprise attack? ... [A]s long
as the armored vehicles didn''t try to use Canadian coins on the toll roads,
there might not be any resistance from state or local authorities. --Kevin, SDM
sumedh wrote:I tried running following c++ code
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
typedef void my_lib_void;
printf("Hello void %d",sizeof(my_lib_void));
system("PAUSE");
return 0;
}
it gives an error on second line of main()..
but at same time if c code
int main()
{
typedef void my_lib_void;
printf("Hello void %d",sizeof(my_lib_void));
system("PAUSE");
return 0;
}
it works showing sizeof(my_lib_void) as 1
Can anyone explain why?Please don''t top-post. Also post C++ related questions to a C++ group
like comp.lang.c++.
Both your programs make no sense. What''s the point in trying to take
the size of a non-existent type? C++''s rules are strict enough to
prevent compilation, while in C it compiles with a diagnostic and
produces nonsense as result.
这篇关于另一个列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!