private struct synthax

This is a discussion on private struct synthax within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by laserlight Code: template <class T> typename bst<T>::sNode* bst<T>::insert( typename bst<T>:: sNode *node, T &data) { I just ...

  1. #16
    coder
    Join Date
    Feb 2008
    Posts
    127
    Quote Originally Posted by laserlight
    Code:
    template <class T>
    typename bst<T>::sNode* bst<T>::insert(typename bst<T>::sNode *node, T &data) {
    I just want to point that even the following code compiles correctly:
    Code:
    template <class T>
    typename bst<T>::sNode* bst<T>::insert(sNode *node, T &data) {

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,901
    I think Visual Studio is good at ignoring the typename (or not requiring) keyword. However, that doesn't mean it's right. The standard says to use it.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #18
    coder
    Join Date
    Feb 2008
    Posts
    127
    Thanks.
    Infact I was wondering if the compiler was just ignoring that.
    anyway I'm using g++ ;P

  4. #19
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Actually, that's not a case of omitting the typename keyword, but of omitting the containing type within the scope of this type, which is perfectly valid and portable.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Link List math
    By t014y in forum C Programming
    Replies: 17
    Last Post: 02-20-2009, 06:55 PM
  2. C# and SQL
    By siten0308 in forum C# Programming
    Replies: 2
    Last Post: 07-09-2008, 01:34 PM
  3. Function validation.
    By Fhl in forum C Programming
    Replies: 10
    Last Post: 02-22-2006, 08:18 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  5. problem with structures and linked list
    By Gkitty in forum C Programming
    Replies: 6
    Last Post: 12-12-2002, 06:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21