Question

Given the following in-progress C++ code:

if (true)
    std

, as soon as I enter the first colon (:) of the scope resolution operator (::), XCode oddly inserts some square brackets, and my code looks like this:

if [(true)
    std:]

This is really annoying, and it can't figure out why it's doing it. At the moment it's doing it in some files but not others.

Was it helpful?

Solution

It looks like it's trying to help you with Objective C syntax.

At a guess, the files where it's trying to do that have an extension indicating that what you're writing is Objective C. The files where it's not doing it are those that have an extension indicating that they contain C++ instead.

OTHER TIPS

It's trying to be nice and complete the Obj-C syntax.

object method

Adding a colon next turns into

[object methodWithParameter:(parameter) ]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top