473,379 Members | 1,367 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

ANSI C?

Is the following program considered ANSI C?

#include <foo/foo_bar.h/* has prototype void bar(void) */
int main(void)
{
bar();
return 0;
}

Thanks
--
Billy

Feb 5 '08 #1
10 2201
Billy Bong wrote:
Is the following program considered ANSI C?
Why shouldn't it be?
#include <foo/foo_bar.h/* has prototype void bar(void) */
int main(void)
{
bar();
return 0;
}

Thanks

--
Ian Collins.
Feb 5 '08 #2
Billy Bong <bi**********@aol.comwrites:
Is the following program considered ANSI C?

#include <foo/foo_bar.h/* has prototype void bar(void) */
int main(void)
{
bar();
return 0;
}

Thanks
What does "Thanks" do?
Feb 5 '08 #3

"Billy Bong" <bi**********@aol.comwrote in message
Is the following program considered ANSI C?

#include <foo/foo_bar.h/* has prototype void bar(void) */
int main(void)
{
bar();
return 0;
}
Depends what you mean.

The language itself will almost certainly be ANSI C89. However you are
including a non-standard header. bar() itself could be implemented in any
language that provides facilities for C-style linking, and may or may not be
portable.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Feb 5 '08 #4
Malcolm McLean wrote:
>
"Billy Bong" <bi**********@aol.comwrote in message
>Is the following program considered ANSI C?

#include <foo/foo_bar.h/* has prototype void bar(void) */
int main(void)
{
bar();
return 0;
}
Depends what you mean.

The language itself will almost certainly be ANSI C89.
IME most C compilers seem to have implemented changes upto at least C95
with portions of C99.
However you are
including a non-standard header. bar() itself could be implemented in
any language that provides facilities for C-style linking, and may or
may not be portable.
Perhaps the OP is asking whether the forward slash in the header name is
portable.

Feb 5 '08 #5
santosh wrote:
Malcolm McLean wrote:
>"Billy Bong" <bi**********@aol.comwrote in message
....
Perhaps the OP is asking whether the forward slash in the header name is
portable.
It's hard to know what the OP is interested in.

My impression is that he is mainly interested in increasing the
noise-to-signal ratio here, so I killfiled him some time ago.
Feb 5 '08 #6
On Tue, 05 Feb 2008 08:17:58 GMT, Billy Bong <bi**********@aol.com>
wrote in comp.lang.c:
Is the following program considered ANSI C?
The following is NOT a program.
#include <foo/foo_bar.h/* has prototype void bar(void) */
int main(void)
{
bar();
return 0;
}

Thanks
What it is, together with the contents of "foo/foo_bar.h", plus the
inclusion of anything else that might be indicated by preprocessor
inclusion directives in "foo/foo_bar.h", is a "translation unit".

Once it has been compiled and combined with other appropriate
separately compiled translation units, it might become a program.

The part of the program you have shown is conforming, and it might or
might not be strictly conforming. There is no such thing as an "ANSI
C" program.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Feb 6 '08 #7
santosh <sa*********@gmail.comwrites:
[...]
The '-ansi' option tells gcc to adhere to the "C90" Standard, i.e.,
ISO:9899:1990. It's also called as "C89" or "ANSI C". But strictly
speaking the last one (ANSI C) is invalid as "ANSI C" now refers to the
Standard ratified by ANSI currently, which is ISO:9899:1999.
[...]

That's true, but in practice the term "ANSI C" almost always refers to
the language defined by the ANSI C89 standard (or, equivalently, by
the ISO C90 standard). I think that most people who know and care
about the difference use the term "ISO C" or, more commonly, refer
specifically to C89/C90 or to C99.

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Feb 6 '08 #8
Groovy hepcat Billy Bong was jivin' in comp.lang.c on Tue, 5 Feb 2008
7:17 pm. It's a cool scene! Dig it.
Is the following program considered ANSI C?

#include <foo/foo_bar.h/* has prototype void bar(void) */
int main(void)
{
bar();
return 0;
}
No. If foo/foo_bar.h is a user defined header, you should be including
it like so:

#include "foo/foo_bar.h"

Otherwise it is a header provided by the implementation, and is
therefore an extention. (Well, it could be a third party header stored
where the implementation stores its headers, but in either case it
isn't a portable header.)
And function bar() is non-standard, and must be provided by the author
of the code or the implementation's run time library (or a third party
library).

--
Dig the sig!

----------- Peter 'Shaggy' Haywood ------------
Ain't I'm a dawg!!
Feb 7 '08 #9
Billy Bong wrote:
In other words, no ANSI C compiler, let alone any ANSI C compiler that
builds on a UNIX-like system, is obliged to accept this? [1]
The GSL code is inundated with code like this:

#include <gsl/gsl_errno.h>
In other words,
my ANSI C compiler does not compile
#include <gsl/gsl_errno.h>,
and the standard allows my ANSI C compiler to be that way;
if your ANSI C compiler does compile
#include <gsl/gsl_errno.h>,
the standard allows that too.

--
pete
Feb 8 '08 #10
Richard Heathfield wrote:
The fact that they are not topical here does not make them
evil, any more than the fact that cheesecake is not topical here makes
cheesecake evil.
That's a relief, considering that I spent a couple of hours last night
baking two big cheesecakes for my colleagues, as today is the last day
for me on this job.

It would've been a pain to have to tell them: Sorry, guys, no
cheesecake today (or ever). Yup, that's right. Dick Heathfield said so.
Look it up on Usenet.

robert
Feb 8 '08 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Eric Myers | last post by:
Hello folks: (This message is also posted on the help forum at the pexpect sourceforge page, but all indentation in the code got stripped away when I submitted the post.) For some time I've...
100
by: Roose | last post by:
Just to make a tangential point here, in case anyone new to C doesn't understand what all these flame wars are about. Shorthand title: "My boss would fire me if I wrote 100% ANSI C code" We...
4
by: Luke Wu | last post by:
I am just wondering what the following terms usually mean: 1) "Standard C" 2) "K&R C" 3) "ANSI C" I am pretty sure "ANSI C" usually refers to the C89 standard, but what
83
by: sunny | last post by:
Hi All What is C99 Standard is all about. is it portable, i mean i saw -std=C99 option in GCC but there is no such thing in VC++.? which one is better ANSI C / C99? can i know the major...
7
by: Paul Connolly | last post by:
char *s = "Hello"; s = 'J'; puts(s); might print "Jello" in a pre-ANSI compiler - is the behaviour of this program undefined in any pre-ANSI compiler - or would it always have printed "Jello"...
127
by: bz800k | last post by:
Hi Does this code satisfy ANSI C syntax ? void function(void) { int a = 2; a = ({int c; c = a + 2;}); /* <<-- here !! */ printf("a=%d\n", a);
0
NeoPa
by: NeoPa | last post by:
ANSI-89 v ANSI-92 Before we get into all the various types of pattern matching that can be used, there are two ANSI standards used for the main types of wildcard matching (matching zero or more...
41
by: jaysome | last post by:
It's been almost eight years since ISO/IEC approved ISO/IEC 9899:1999. Does anyone know if ANSI has approved it? A Google search shows arguably confusing answers as to whether ANSI has...
8
AmberJain
by: AmberJain | last post by:
HELLO, Is it necessary for a C programmer to have an ANSI C standard or it's sufficient to own Kernigham and Rithie's The C programming language? I know that the ritchie's book is quite brief...
6
by: Peng Yu | last post by:
Hi, ANSI and GNU C are different in some delicate aspects (I'm not sure about C++). For example, M_PI is not in ANSI C but in GNU C. Of course, to make my program most portable, I should go...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.