On 2012-07-19 11:38, Regan Heath wrote:
asn't ware that was valid ANSI C, perhaps it's a GCC/clang
feature? Can anyone find docs on it?
Note that it only works when compiling as C++. Perhaps it works like this:
If C++ is interpreting this:
void foo ();
As:
void foo (void);
Perhaps it will
On Thu, 19 Jul 2012 08:33:12 +0100, Paulo Pinto
wrote:
On Wednesday, 18 July 2012 at 20:13:10 UTC, Walter Bright wrote:
On 7/18/2012 11:47 AM, Jacob Carlborg wrote:
On 2012-07-18 20:43, Walter Bright wrote:
On 7/18/2012 4:59 AM, Jacob Carlborg wrote:
Does that mean that this C++ declarati
On Wednesday, 18 July 2012 at 20:13:10 UTC, Walter Bright wrote:
On 7/18/2012 11:47 AM, Jacob Carlborg wrote:
On 2012-07-18 20:43, Walter Bright wrote:
On 7/18/2012 4:59 AM, Jacob Carlborg wrote:
Does that mean that this C++ declaration:
void foo (...);
Not allowed in C or C++.
When compi
On 2012-07-18 22:12, Walter Bright wrote:
How would you get the arguments inside foo?
I don't know, you're the compiler writer :) I don't know these kind of
things, that's why I started this thread. I'm just telling you how
GCC/Clang treats these code snippets.
--
/Jacob Carlborg
On 7/18/2012 11:47 AM, Jacob Carlborg wrote:
On 2012-07-18 20:43, Walter Bright wrote:
On 7/18/2012 4:59 AM, Jacob Carlborg wrote:
Does that mean that this C++ declaration:
void foo (...);
Not allowed in C or C++.
When compiling in C++ mode, both Clang and GCC accepts this.
How would you
On 2012-07-18 20:43, Walter Bright wrote:
On 7/18/2012 4:59 AM, Jacob Carlborg wrote:
Does that mean that this C++ declaration:
void foo (...);
Not allowed in C or C++.
When compiling in C++ mode, both Clang and GCC accepts this.
Is the same as this C declaration?
void foo ();
That is
On 7/18/2012 4:59 AM, Jacob Carlborg wrote:
Does that mean that this C++ declaration:
void foo (...);
Not allowed in C or C++.
Is the same as this C declaration?
void foo ();
That is void foo(void) in C++.
On Wed, Jul 18, 2012 at 11:23:33AM +0100, Regan Heath wrote:
> On Tue, 17 Jul 2012 19:39:25 +0100, H. S. Teoh
> wrote:
[...]
> >This modern C declaration:
> >
> > int main(int argc, char **argv) {
> > exit(1);
> > }
> >
> >is written thus in K&R:
> >
> > int main(argc, argv
On 2012-07-18 11:41, Walter Bright wrote:
Variadic functions, in order to work in C, need at least one parameter
so that varargs can work.
int foo();
declares a function with an unspecified parameter list, not a variadic
one. It is specified by a definition somewhere:
int foo(a,b)
in
On 2012-07-18 12:25, Regan Heath wrote:
In any case. It think the practical solution to this problem is to
assume you're working with modern code, and have a command line option
to make it assume K&R or old-style declarations.
In the old-style mode you would have to assume a function with an em
On Tue, 17 Jul 2012 19:08:51 +0100, Paulo Pinto
wrote:
On Tuesday, 17 July 2012 at 15:13:52 UTC, Regan Heath wrote:
On Tue, 17 Jul 2012 15:50:27 +0100, Jacob Carlborg wrote:
On 2012-07-17 16:37, Regan Heath wrote:
All my googling for "old style" "variadic" etc returned the use of
va_ali
On Tue, 17 Jul 2012 20:42:09 +0100, Jacob Carlborg wrote:
On 2012-07-17 17:13, Regan Heath wrote:
Is Clang open source, can we see the code for that function? Perhaps
it's a bug.. ANSI C may have made () without "void" obsolete, but no
compiler I've ever used has actually enforced that - or
In any case. It think the practical solution to this problem is to assume
you're working with modern code, and have a command line option to make it
assume K&R or old-style declarations.
In the old-style mode you would have to assume a function with an empty ()
could have any number of par
On Tue, 17 Jul 2012 20:31:19 +0100, Jacob Carlborg wrote:
On 2012-07-17 17:11, Regan Heath wrote:
Ahh, I've been looking at the ANSI C spec and assuming that is what
you're basing things off, K&R C was pre-ANSI C and may have different
rules. I think you should probably aim to be ANSI C comp
On Tue, 17 Jul 2012 19:39:25 +0100, H. S. Teoh
wrote:
On Tue, Jul 17, 2012 at 08:07:08PM +0200, Paulo Pinto wrote:
On Tuesday, 17 July 2012 at 15:16:56 UTC, Regan Heath wrote:
[...]
>So all K&R function declarations were () with no parameters.
>
>R
K&R was more than that.
This modern C
On 7/16/2012 11:56 PM, Jacob Carlborg wrote:
To my understanding this is legal C :
int foo ();
It's a K&R-style variadic functions, while their use is discouraged, they're
still legal C.
Variadic functions, in order to work in C, need at least one parameter so that
varargs can
On Tuesday, 17 July 2012 at 18:37:54 UTC, H. S. Teoh wrote:
I guess you predate me. ;-) When I started learning C, it was
already in
the ANSI syntax, though there were enough K&R style code
floating around
that I've at least _seen_ K&R syntax. I'm guessing nowadays
most people
don't even know
Definitely - I live in a very technologically-savvy dorm in college, and
when I encountered it for the first time nobody there had any idea what
it was.
...we did later find an old book in our library that had it, though.
-Matt
On 07/17/2012 02:39 PM, H. S. Teoh wrote:
On Tue, Jul 17, 2012 at
I was sure that if function is declared with empty () than you
can call it with any arguments you imagine, as it is in following
examples.
= ex. 1
<*> cat main.c
void a() {
}
int main()
{
a(1, 2, 3);
return 0;
}
<*> gcc -Wall -Wextra -pedantic main.c
<*>
=
On 2012-07-17 17:13, Regan Heath wrote:
Is Clang open source, can we see the code for that function? Perhaps
it's a bug.. ANSI C may have made () without "void" obsolete, but no
compiler I've ever used has actually enforced that - or perhaps C++ made
old-style function definition/declarations o
On 2012-07-17 17:11, Regan Heath wrote:
Ahh, I've been looking at the ANSI C spec and assuming that is what
you're basing things off, K&R C was pre-ANSI C and may have different
rules. I think you should probably aim to be ANSI C compliant and
above, and ignore K&R.
This page says otherwise:
On Tue, Jul 17, 2012 at 08:07:08PM +0200, Paulo Pinto wrote:
> On Tuesday, 17 July 2012 at 15:16:56 UTC, Regan Heath wrote:
[...]
> >So all K&R function declarations were () with no parameters.
> >
> >R
>
> K&R was more than that.
This modern C declaration:
int main(int argc, char **argv
On Tuesday, 17 July 2012 at 15:13:52 UTC, Regan Heath wrote:
On Tue, 17 Jul 2012 15:50:27 +0100, Jacob Carlborg
wrote:
On 2012-07-17 16:37, Regan Heath wrote:
All my googling for "old style" "variadic" etc returned the
use of
va_alist and va_dcl so I can't see where/why Clang would do
what
On Tuesday, 17 July 2012 at 15:16:56 UTC, Regan Heath wrote:
On Tue, 17 Jul 2012 15:46:34 +0100, Jacob Carlborg
wrote:
On 2012-07-17 16:36, Regan Heath wrote:
I believe old-style no parameter function declarations MUST
have "void"
i.e.
int foo(void);
That is still the case, regardle
"deadalnix" wrote in message
news:ju3uqc$55g$1...@digitalmars.com...
>
> It is used in testfptr.d from dmd's testsuite.
No, that's a D-linkage variadic.
On Tue, 17 Jul 2012 15:46:34 +0100, Jacob Carlborg wrote:
On 2012-07-17 16:36, Regan Heath wrote:
I believe old-style no parameter function declarations MUST have "void"
i.e.
int foo(void);
That is still the case, regardless of "style"?
They cannot read:
int foo();
The latter
On Tue, 17 Jul 2012 15:50:27 +0100, Jacob Carlborg wrote:
On 2012-07-17 16:37, Regan Heath wrote:
All my googling for "old style" "variadic" etc returned the use of
va_alist and va_dcl so I can't see where/why Clang would do what it's
doing.
To be accurate it's the libclang function "clang_
On Tue, 17 Jul 2012 15:46:34 +0100, Jacob Carlborg wrote:
On 2012-07-17 16:36, Regan Heath wrote:
I believe old-style no parameter function declarations MUST have "void"
i.e.
int foo(void);
That is still the case, regardless of "style"?
They cannot read:
int foo();
The latter
On 17/07/2012 08:56, Jacob Carlborg wrote:
To my understanding this is legal C :
int foo ();
It's a K&R-style variadic functions, while their use is discouraged,
they're still legal C.
If I, in D, declare a variadic function with C linkage that doesn't
take, at least, on
On 2012-07-17 16:37, Regan Heath wrote:
All my googling for "old style" "variadic" etc returned the use of
va_alist and va_dcl so I can't see where/why Clang would do what it's
doing.
To be accurate it's the libclang function "clang_isFunctionTypeVariadic"
that returns true.
http://clang.ll
On 2012-07-17 16:36, Regan Heath wrote:
I believe old-style no parameter function declarations MUST have "void"
i.e.
int foo(void);
That is still the case, regardless of "style"?
They cannot read:
int foo();
The latter MUST have parameters, we just can't tell what they are.
Ta
On Tue, 17 Jul 2012 15:01:02 +0100, Jacob Carlborg wrote:
On 2012-07-17 15:05, Regan Heath wrote:
In my specific case I could add "int a" as the first parameter, and all
was well. Each case will be different, and it's conceivable there is a
C old-style variadic which takes /any/ type of firs
On Tue, 17 Jul 2012 15:02:44 +0100, Jacob Carlborg wrote:
On 2012-07-17 14:32, Regan Heath wrote:
After a bit of googling and a test with my local MSVC9 I think old-style
variadics look like this:
#include
#include
void foo(va_alist)
va_dcl
{
va_list p;
va_start(p);
v
On 2012-07-17 15:05, Regan Heath wrote:
In my specific case I could add "int a" as the first parameter, and all
was well. Each case will be different, and it's conceivable there is a
C old-style variadic which takes /any/ type of first parameter, which
could be a problem, however the key issue
On 2012-07-17 14:32, Regan Heath wrote:
After a bit of googling and a test with my local MSVC9 I think old-style
variadics look like this:
#include
#include
void foo(va_alist)
va_dcl
{
va_list p;
va_start(p);
vprintf("%d %d %d\n", p);
}
void main()
{
foo(1, 2, 3);
On Tue, 17 Jul 2012 13:32:08 +0100, Regan Heath
wrote:
On Tue, 17 Jul 2012 12:43:46 +0100, Jacob Carlborg wrote:
On 2012-07-17 09:06, Mehrdad wrote:
My eyes!! They're bleeding!!
First I wanted to know if my interpretation is correct and then I was
trying to figure out how my tool sho
On Tue, 17 Jul 2012 12:43:46 +0100, Jacob Carlborg wrote:
On 2012-07-17 09:06, Mehrdad wrote:
My eyes!! They're bleeding!!
First I wanted to know if my interpretation is correct and then I was
trying to figure out how my tool should behave if it encounters a
function like this.
After
On 2012-07-17 09:06, Mehrdad wrote:
My eyes!! They're bleeding!!
First I wanted to know if my interpretation is correct and then I was
trying to figure out how my tool should behave if it encounters a
function like this.
--
/Jacob Carlborg
On Tuesday, 17 July 2012 at 07:06:38 UTC, Mehrdad wrote:
On Tuesday, 17 July 2012 at 06:56:17 UTC, Jacob Carlborg wrote:
To my understanding this is legal C :
int foo ();
It's a K&R-style variadic functions, while their use is
discouraged, they're still legal C.
My
On Tuesday, 17 July 2012 at 06:56:17 UTC, Jacob Carlborg wrote:
To my understanding this is legal C :
int foo ();
It's a K&R-style variadic functions, while their use is
discouraged, they're still legal C.
My eyes!! They're bleeding!!
To my understanding this is legal C :
int foo ();
It's a K&R-style variadic functions, while their use is discouraged,
they're still legal C.
If I, in D, declare a variadic function with C linkage that doesn't
take, at least, one regular parameter the compiler will co
41 matches
Mail list logo