a simple ques

C

call_me_anything

This is like saying that a Ph.D. student cannot solve a high school
problem.
Come on dude! You can tell the answer if you know it.
I am sure many C++ programmers also wouldn't be knowing the difference
either.

And if it makes you happy, here is another version of the same
problem :

Class foo;
Is foo [5:0] abc;
different from
foo abc [5:0];




Is char [5:0] abc
different from
char abc [5:0] ?

Yes, but non of it is C++.
 
L

Lionel B

Is char [5:0] abc
different from
char abc [5:0] ?

Yes, but non of it is C++.
This is like saying that a Ph.D. student cannot solve a high school
problem. Come on dude! You can tell the answer if you know it.

He did tell you the answer: it's not C++.
I am sure many C++
programmers also wouldn't be knowing the difference either.

And if it makes you happy, here is another version of the same problem :

Class foo;
Is foo [5:0] abc;
different from
foo abc [5:0];

Still not C++. Have you tried compiling any of this with a standard C++
compiler?
 
R

Rolf Magnus

call_me_anything said:
Come on dude! You can tell the answer if you know it.
I am sure many C++ programmers also wouldn't be knowing the difference
either.

Why should they? I am sure that many of them (like me) don't even know what
language your code is supposed to be. It's not C++, so a C++ programmer
doesn't need to know.
And if it makes you happy, here is another version of the same
problem :

Class foo;
Is foo [5:0] abc;
different from
foo abc [5:0];

Yes, the problem is still the same: It's not C++ code.
 
L

LR

call_me_anything wrote:

Top posting is very confusing to me, so I moved what you wrote.

Is char [5:0] abc
different from
char abc [5:0] ?
Yes, but non of it is C++.


> This is like saying that a Ph.D. student cannot solve a high school
> problem.

I completely fail to understand that. In what way does the answer you
received even imply that?
> Come on dude! You can tell the answer if you know it.
> I am sure many C++ programmers also wouldn't be knowing the difference
> either.

I suppose that I am one of the C++ programmers who don't recognize what
you posted as being C++ code. Is this some sort of trick question?
>
> And if it makes you happy, here is another version of the same
> problem :
>
> Class foo;

'Class foo;' is not valid C++. Did you mean 'class foo;'?

Although, of course,

class Class {};
Class foo;

is valid, but using 'Class' as a class name would probably not be a good
idea.

However if,

class foo;
foo abc;

then foo is an imcomplete type and so this will not compile.
> Is foo [5:0] abc;
> different from
> foo abc [5:0];



AFAIK, '[5:0]' is not part of C++. Or at least its a part of C++ I am
unfamiliar with.

However, on the theory (something for which the evidence is well
established) that I am often wrong or ignorant, I tried two variants of
your code at http://www.comeaucomputing.com/tryitout/

First,

class foo {};
foo [5:0] abc;

and then,

class foo {};
foo abc [5:0];

Both of these failed to compile. So, I conclude that Mr. Wikstrom's
answer was correct.

I also tried
class foo {};
foo abc;

And that compiled.

I feel certain, or at least, I suspect, that if you will explain the
question that you want answered, you will get better information.

As it is, I'm not quite sure what question you want answered.

Might I recommend that you post the shortest compilable version of the
code that you wish to ask about.

http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.8

LR
 
S

Stuart Golodetz

Is char [5:0] abc
different from
char abc [5:0] ?

Yes, but non of it is C++.

call_me_anything said:
This is like saying that a Ph.D. student cannot solve a high school
problem.
Come on dude! You can tell the answer if you know it.
I am sure many C++ programmers also wouldn't be knowing the difference
either.
And if it makes you happy, here is another version of the same
problem :
Class foo;
Is foo [5:0] abc;
different from
foo abc [5:0];

The statement "A Ph.D. student cannot solve a high school problem" is almost
certainly true. Or in other words, the chances of there existing a Ph.D.
student s and a high school problem p such that Can'tSolve(s, p) is true
[where the semantics of Can'tSolve(s, p) are such that s can't solve p in
real life] are extremely high. As it happens, I'm a Ph.D. student, and there
are lots of high school problems in subjects I didn't take that I can't
solve (and a fair few in subjects I did take, especially ones I've
forgotten). Why would you expect that for all students s and high school
problems p, CanSolve(s, p)? In fact, I very much doubt if there exists a
student s such that, for all high school problems p, CanSolve(s, p)...

Anyway, in answer to question, the only plausible answer is "Maybe. Define
the semantics of 'different' in the language in which you're writing."
People in this newsgroup understand the semantics of things in C++, but what
you've written is in a language which no-one here recognises, so you need to
tell us what you mean before we can answer your question. (Incidentally,
since your code isn't in C++, it's off-topic, but that's another matter.)

To clarify this point, consider two possibilities for the above:

1) In your language, two snippets like the above are 'different' iff they
differ textually. In that case, the answer to your question is indubitably
'yes'.
2) In your language, two snippets like the above are 'different' if the
characters of either snippet are not a permutation of those of the other. In
that case, the answer to your question is 'no', since either snippet in the
above could be transformed into the other by permuting its characters.

HTH,
Stu

P.S. I strongly suspect you're a troll. Stop it :)
 
S

Stuart Golodetz

2) In your language, two snippets like the above are 'different' if the

....'different' iff...

(Sorry)
characters of either snippet are not a permutation of those of the other.
In that case, the answer to your question is 'no', since either snippet in
the above could be transformed into the other by permuting its characters.

HTH,
Stu
<snip>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

C faq ,ques-2.9,2.18 9
ques 1.34 c-faq 26
A simple form question 2
C basic query 1
Output pridiction 4
Simple functions don't work :( 3
Simple Test Framework 0
New to python NEED SIMPLE MATH CODE plz 3

Members online

Forum statistics

Threads
474,181
Messages
2,570,970
Members
47,536
Latest member
VeldaYoung

Latest Threads

Top