From: Jason on
On May 10, 8:57 am, Vladimir Vassilevsky <nos...(a)nowhere.com> wrote:
> Rune Allnor wrote:
> > I don't remember off the top of my head if 'new' is a reserved
> > word in C. Assuming it's not - and also assuming that the compiler
> > indeed worked in C mode - that would be a bug in the compiler
> > rather than a C/C++ clash.
>
> > Not that it makes any difference, where and when one hits the
> > snag...
>
> Question to C++ - ers:
>
> for(int i = 0; i < 100; i++)
>   {
>   // do something
>   }
>
> cout << i;
>
> I've seen compilers that compile this as well as the others that won't
> compile. Which ones are right?
>
> Vladimir Vassilevsky
> DSP and Mixed Signal Design Consultanthttp://www.abvolt.com

That type of declaration is acceptable according to C99 and C++. A C++
compiler will accept it, and a C compiler in C99 mode (gcc is by
default) will also. However, if your compiler expects you to use an
older C standard, it will report them as errors. You can instruct gcc
to do this via some command-line flags if you're so inclined.

Jason
From: Manny on
On May 7, 2:03 pm, "third_person" <third_person(a)n_o_s_p_a_m.ymail.com>
wrote:
> Hello,
>
> I'm an undergrad student and want to learn how to implement DSP algorithms
> on embedded systems.
>
> The first step, I think should be to learn how to implement them in C or
> C++, but I have two questions before I begin.
>
> Q1) Should I start with C or C++? which is used more and why?
>
> Q2) Recently there is a lot of talk of HDL? Should I do programming in HDL
> rather than C/C++?
>
> Q3) Is there any software (except the C/C++ compiler) within which I can
> practice?
>
> I'm looking for an interface which resembles for e.g. Code Composer Studio
> so that the transition from practice to actually embedding will be smooth..
>
> Regards,
>
> 3P

If you ask me, I'd say thing is so vast anything you dab at will move
you a step in the 10k mile journey. You can concern yourself with
technology-related issue as much as you want. Eventually you'll
realize, "wait a second, I don't want to be a code monkey!" At any
rate, circumstances will present themselves and position you some how
provided that you stay long enough in the field. Old dogs whom we can
only warship and admire tend to think in software terms, another
branch of folks think hardware; mixed and digital. Now industry is
pushing for a uniform approach using the emerging ESL methodology.
Whatever you do, it's going to be pain and you'll have to get
accustomed to constant learning in tackling whatever gets thrown at
you; from cut-set theory all the way down to good old Bessel.

-Momo
From: Erik de Castro Lopo on
Rune Allnor wrote:

> I know that C99 introduced certain keywords and extensions
> that did not make it to the C++ standard, but they weren't
> too many. Of course, some of the C99 extensions, like fixed-
> size integer data types, were particularly pertinent to DSP,
> which in turn means that somebody playing with DSP are far
> more likely to hit the C/C++ incopatibility snags...

Here is a piece of C code (from Chris Torek) that gives different
results when compiled with tandards compliant C and C++ compilers.

#include <stdio.h>

struct A { int x[1]; };

int
main(void)
{ struct B { struct A { int x[1000]; } b; } var;

printf("sizeof(struct A) = %lu\n", (unsigned long)sizeof(struct A));

return 0;
}

Hope this helps.

Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
From: Andreas Huennebeck on
Erik de Castro Lopo wrote:

> Here is a piece of C code (from Chris Torek) that gives different
> results when compiled with tandards compliant C and C++ compilers.
>
> #include <stdio.h>
>
> struct A { int x[1]; };
>
> int
> main(void)
> { struct B { struct A { int x[1000]; } b; } var;
>
> printf("sizeof(struct A) = %lu\n", (unsigned long)sizeof(struct
> A));
>
> return 0;
> }

A quite comprehensive list of differences between the many flavours
of C and C++ is here: http://david.tribble.com/text/cdiffs.htm

The case shown in the piece of code above is described in the section
'Nested structure tags'.

bye
Andreas
--
Andreas H�nnebeck | email: acmh(a)gmx.de
----- privat ---- | www : http://www.huennebeck-online.de
Fax/Anrufbeantworter: 0721/151-284301
GPG-Key: http://www.huennebeck-online.de/public_keys/andreas.asc
PGP-Key: http://www.huennebeck-online.de/public_keys/pgp_andreas.asc

From: Rob Gaddi on
On 5/11/2010 5:22 PM, Erik de Castro Lopo wrote:
> Rune Allnor wrote:
>
>> I know that C99 introduced certain keywords and extensions
>> that did not make it to the C++ standard, but they weren't
>> too many. Of course, some of the C99 extensions, like fixed-
>> size integer data types, were particularly pertinent to DSP,
>> which in turn means that somebody playing with DSP are far
>> more likely to hit the C/C++ incopatibility snags...
>
> Here is a piece of C code (from Chris Torek) that gives different
> results when compiled with tandards compliant C and C++ compilers.
>
> #include<stdio.h>
>
> struct A { int x[1]; };
>
> int
> main(void)
> { struct B { struct A { int x[1000]; } b; } var;
>
> printf("sizeof(struct A) = %lu\n", (unsigned long)sizeof(struct A));
>
> return 0;
> }
>
> Hope this helps.
>
> Erik

And yet it's a bit of a pathological case, isn't it? No, at the end of
the day C++ and C (and for that matter C99) aren't 100% compatible, and
you need to know which language you're writing for. But the vast
majority of C code will just work.

--
Rob Gaddi, Highland Technology
Email address is currently out of order