PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > a simple ques
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
a simple ques

Réponse
 
LinkBack Outils de la discussion
Vieux 29/12/2007, 12h12   #1
call_me_anything
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut a simple ques

Is char [5:0] abc

different from

char abc [5:0] ?
  Réponse avec citation
Vieux 29/12/2007, 12h44   #2
Erik Wikström
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: a simple ques

On 2007-12-29 13:12, call_me_anything wrote:
> Is char [5:0] abc
>
> different from
>
> char abc [5:0] ?


Yes, but non of it is C++.

--
Erik Wikström
  Réponse avec citation
Vieux 30/12/2007, 09h03   #3
call_me_anything
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: a simple ques

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];




On Dec 29, 5:44 pm, Erik Wikström <Erik-wikst...@telia.com> wrote:
> On 2007-12-29 13:12, call_me_anything wrote:
>
> > Is char [5:0] abc

>
> > different from

>
> > char abc [5:0] ?

>
> Yes, but non of it is C++.
>
> --
> Erik Wikström


  Réponse avec citation
Vieux 30/12/2007, 11h15   #4
Lionel B
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: a simple ques

On Sun, 30 Dec 2007 01:03:06 -0800, call_me_anything wrote:
>
> On Dec 29, 5:44 pm, Erik Wikström <Erik-wikst...@telia.com> wrote:
>> On 2007-12-29 13:12, call_me_anything 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. 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?

--
Lionel B
  Réponse avec citation
Vieux 30/12/2007, 12h55   #5
Rolf Magnus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: a simple ques

call_me_anything wrote:

> 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.

  Réponse avec citation
Vieux 30/12/2007, 17h14   #6
LR
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: a simple ques

call_me_anything wrote:

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


> On Dec 29, 5:44 pm, Erik Wikström <Erik-wikst...@telia.com> wrote:
>> On 2007-12-29 13:12, call_me_anything wrote:
>>
>>> Is char [5:0] abc
>>> different from
>>> char abc [5:0] ?

>> Yes, but non of it is C++.
>>
>> --
>> Erik Wikström

>



> 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-lit...t.html#faq-5.8

LR
  Réponse avec citation
Vieux 30/12/2007, 18h56   #7
Stuart Golodetz
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: a simple ques

On Dec 29, 5:44 pm, Erik Wikström <Erik-wikst...@telia.com> wrote:
> On 2007-12-29 13:12, call_me_anything wrote:
>
> > Is char [5:0] abc

>
> > different from

>
> > char abc [5:0] ?

>
> Yes, but non of it is C++.
>
> --
> Erik Wikström


"call_me_anything" <sgiitnewid@gmail.com> wrote in message
news:0b6aa8bc-8ed6-4d7d-bcc2-b17f47dadd80@i12g2000prf.googlegroups.com...
>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 :-)


  Réponse avec citation
Vieux 30/12/2007, 18h57   #8
Stuart Golodetz
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: a simple ques

<snip>
> 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>


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 01h58.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,16872 seconds with 16 queries