支持变量类型'long long int'有多广泛? [英] How widely supported is variable type 'long long int' ?

查看:87
本文介绍了支持变量类型'long long int'有多广泛?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C中维护/增强了一些继承的FOSS软件,它有很多不同类似Unix的操作系统的b
编译器选项,其中很多我都是我从来没有听说过。


这将是方便的(并且对于某些可能需要的东西)

使用长整数和/或无符号长整数

变量。


这些变量类型的支持程度如何?他们介绍了多久以前的b $ b?我注意到它们在K& R#2中没有被提及。


感谢您的帮助。


问候,

Charles Sullivan

I maintain/enhance some inherited FOSS software in C which has
compiler options for quite a few different Unix-like operating
systems, many of which I''ve never even heard of.

It would be convenient (and for some things possibly necessary)
to use long long integer and/or unsigned long long integer
variables.

How widely supported are these variable types? How long ago were
they introduced? I notice they are not mentioned in K&R #2.

Thanks for your help.

Regards,
Charles Sullivan

推荐答案

6月22日下午2:55,Charles Sullivan< cwsul ... @ triad.rr .comwrote:
On Jun 22, 2:55 pm, Charles Sullivan <cwsul...@triad.rr.comwrote:

我在C中维护/增强了一些继承的FOSS软件,它有很多不同类Unix操作的
编译器选项

系统,其中许多我从未听说过。


这将是方便的(并且可能需要一些东西)

使用长整数和/或无符号长整数

变量。


这些变量类型的支持程度如何?他们介绍了多久以前的b $ b?我注意到K& R#2中没有提到它们。
I maintain/enhance some inherited FOSS software in C which has
compiler options for quite a few different Unix-like operating
systems, many of which I''ve never even heard of.

It would be convenient (and for some things possibly necessary)
to use long long integer and/or unsigned long long integer
variables.

How widely supported are these variable types? How long ago were
they introduced? I notice they are not mentioned in K&R #2.



long long类型正式引入1999 Standard,

因此在K& R2中没有提及它已发布10年早期。

许多编译器在新标准发布之前很久就认可并支持了这种类型,long long基于对此事实的考虑,选择了名称

。虽然大多数编译器都没有实现C99的所有功能,但是在过去10年中发布的许多编译器确实支持很长时间。有些编译器可能需要一个选项来设置
来支持很长时间,所以请记住这一点。至于

它是否足以满足您的需求,那么查看您目前支持的编译器并查看是否有任何
$将是一个好主意。 b $ b他们不支持这种类型并从那里开始。


Robert Gamble

The long long type was officially introduced with the 1999 Standard,
hence no mention of it in K&R2 which was published 10 years earlier.
A number of compilers recognized and supported the type well before
the new Standard was published, the "long long" name was selected
based on consideration of this fact. While most compilers don''t
implement all of C99, a good many of those released in the last 10
years do support long long. Some compilers may require an option to
be set to enable support for long long so keep this in mind. As for
whether it is widely enough supported for your needs, it would be a
good idea to review the compilers you currently support and see if any
of them don''t support this type and go from there.

Robert Gamble


Charles Sullivan< cw ****** @ triad.rr.com编写:
Charles Sullivan <cw******@triad.rr.comwrites:

我在C中维护/增强了一些继承的FOSS软件

编译器选项适用于很多不同的类Unix操作系统,其中很多都是我从未听说过的。


它将是方便的(并且对于一些可能需要的东西)

使用长整数和/或无符号长整数

变量。


这些变量类型的支持程度如何?他们介绍了多久以前的b $ b?我注意到K& R#2中没有提到它们。
I maintain/enhance some inherited FOSS software in C which has
compiler options for quite a few different Unix-like operating
systems, many of which I''ve never even heard of.

It would be convenient (and for some things possibly necessary)
to use long long integer and/or unsigned long long integer
variables.

How widely supported are these variable types? How long ago were
they introduced? I notice they are not mentioned in K&R #2.



类型long long和unsigned long long在1999年的

ISO C标准中引入。该标准尚未广泛实施,

虽然它的部分是。


许多(也许是大多数)编译器支持long long作为扩展,但是在严格的C90模式下调用的
编译器会拒绝很长时间,即使它是b / b
会接受它在一个更放松的模式。


为什么你需要长期?我怀疑你真正需要的是一个

64位整数类型; long long保证(在C99中)至少为
64位,但是在
C90或C99中,很可能长达64位。


我认为有些编译器可能会提供64位整数类型,但

而不使用名称long long (微软?)。


您可以考虑定义自己的类型,也许是long_long。和

" unsigned_long_long",在特定于应用程序的标头中;这些将是

长期长和无符号多长的typedef,它们是可用的b $ b,以及适用于其他任何类型的类型

不是。您应该能够通过检查#ifdef LLONG_MAX来检测是否存在很长时间。 (在#include< limits.h>之后)。


-

Keith Thompson(The_Other_Keith) ks *** @ mib.org < http://www.ghoti.net/~kst>

圣地亚哥超级计算机中心< *< http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。

- Antony Jay和Jonathan Lynn,是部长

The types "long long" and "unsigned long long" were introduced in the
ISO C standard of 1999. That standard is not yet widely implemented,
though pieces of it are.

Many, perhaps most, compilers support long long as an extension, but a
compiler invoked in strict C90 mode will reject long long, even if it
would accept it in a more relaxed mode.

Why do you need "long long"? I suspect what you really need is a
64-bit integer type; long long is guaranteed (in C99) to be at least
64 bits, but it''s entirely possible for long to be 64 bits in either
C90 or C99.

I think that some compilers may provide 64-bit integer types, but
without using the name "long long" (Microsoft?).

You might consider defining your own types, perhaps "long_long" and
"unsigned_long_long", in an application-specific header; these would
be typedefs for long long and unsigned long long where they''re
available, and for whatever other type is appropriate where they''re
not. You should be able to detect whether long long exists by
checking "#ifdef LLONG_MAX" (after #include <limits.h>).

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


Charles Sullivan写道:
Charles Sullivan wrote:

>
>



.... snip ...

.... snip ...


>

使用长整数和/或无符号长整数

变量将是方便的(并且对于某些可能需要的东西)




这些变量类型的支持程度如何?他们介绍了多久以前的b $ b?我注意到K& R#2中没有提到它们。
>
It would be convenient (and for some things possibly necessary)
to use long long integer and/or unsigned long long integer
variables.

How widely supported are these variable types? How long ago were
they introduced? I notice they are not mentioned in K&R #2.



C99引入了Long long。如果你没有C99

兼容的编译器(你可能不会),他们就不会工作。他们

可能在其他系统上作为扩展,但不会是b
便携式。


-

< http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>

< http://www.securityfocus.com/columnists / 423>

< http://www.aaxnet.com/editor/edit043.html>

cbfalconer at maineline dot net

-

通过 http://www.teranews的免费Usenet帐户发布.com

Long long was introduced with C99. If you don''t have a C99
compliant compiler (and you probably don''t) they won''t work. They
may be available on other systems as extensions, but will not be
portable.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline dot net
--
Posted via a free Usenet account from http://www.teranews.com


这篇关于支持变量类型'long long int'有多广泛?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆